Scheduling Merges
Mastering the art of timing your pull request merges with Mergify's scheduling features.
Effectively managing when pull requests are merged is crucial for maintaining a
smooth workflow. Mergify offers various features to schedule merges, providing
flexibility and control over your project’s integration process. This document
outlines how you can schedule your merges using different Mergify features,
including the schedule
condition, current-datetime
condition, Merge-After
feature, and Depends-On
feature.
Scheduling Merges During Work Hours
Section titled Scheduling Merges During Work HoursThe schedule
condition allows you to define specific times during the week
when merges should occur. This is particularly useful for avoiding merges
during off-hours or weekends.
pull_request_rules:
- name: merge during work hours
conditions:
- schedule = Mon-Fri 09:00-17:00[Europe/Paris]
actions:
merge:
In this example, pull requests will only be merged on weekdays between 09:00 and 17:00 Paris time.
Avoid Merges on Specific Dates
Section titled Avoid Merges on Specific DatesThe current-datetime
condition can be used to include or exclude specific
dates or times in your merge automation. It supports being compared to a
timestamp or a timestamp
interval.
pull_request_rules:
- name: avoid merges on specific dates
conditions:
- current-datetime != XXXX-01-01T00:00/XXXX-01-01T23:59[Europe/Paris]
actions:
merge:
This rule prevents merges from occurring on January 1st.
Delay Merge Until a Future Date
Section titled Delay Merge Until a Future DateYou can use the Merge-After
pull request header to merge a pull request after
a certain date.
Mergify automatically injects the current-datetime >=
condition in any rules
that contain the merge
or queue
action.
Using Depends-On
to Manage Merge Dependencies
Section titled Using Depends-On to Manage Merge DependenciesDepends-On
ensures a pull request is only merged after another specified pull
request has been successfully merged. This is useful for managing dependencies
between pull requests.
Mergify automatically injects the depends-on
condition in any rules
that contain the merge
or queue
action.
This rule ensures that the pull request will only be merged after PR #973 is merged.
By using these scheduling features, you can efficiently manage your project’s merge workflow, ensuring that merges happen at the most appropriate times and in the correct order. This not only streamlines your development process but also helps in maintaining stability and continuity in your project.