Configuration Data Types
The different data types you can find in Mergify configuration file
When using templates or conditions, data are made of different types. You will find below the different data types that are available and exposed in Mergify configuration file.
Commit
Section titled CommitA commit is an object that embeds several information about a Git commit
commit_message#commit_verification_verified#Indicates if the commit has been marked as verified by GitHub
committer#Name of the committer
date_committer#email_committer#parents#sha#You can use commit objects in conditions:
pull_request_rules: - name: check that commits are not too old conditions: - commits[*].date_committer < 365 days ago actions: comment: message: One of the commit is too old!Commit Author
Section titled Commit AuthorGlobs
Section titled GlobsYou can use globs expressions with matching operators in your conditions.
| Pattern | Description |
|---|---|
** (entire segment) | Matches any number of file or directory segments, including zero. |
* (entire segment) | Matches one file or directory segment. |
* (part of a segment) | Matches any number of non-separator characters, including zero. |
? | Matches one non-separator character. |
[seq] | Matches one character in seq, where seq is a sequence of characters. Range expressions are supported; e.g., [a-z] matches any lowercase ASCII letter. Multiple ranges can be combined, e.g. [a-zA-Z0-9_] matches any ASCII letter, digit, or underscore. |
[!seq] | Matches one character not in seq, where seq follows the same rules as above. |
The ** wildcard enables recursive globbing. A few examples:
| Pattern | Meaning |
|---|---|
**/* | Any path with at least one segment. |
**/*.py | Any path with a final segment ending in .py. |
assets/** | Any path starting with assets/. |
assets/**/* | Any path starting with assets/, excluding assets/ itself. |
Regular Expressions
Section titled Regular ExpressionsYou can use regular expressions with matching operators in your conditions.
Mergify leverages Python regular expressions to match rules.
pull_request_rules: - name: add python label if a Python file is modified conditions: - files ~= \.py$ actions: label: add: - python
- name: automatic merge for main when the title does not contain “WIP” (ignoring case) conditions: - base = main - -title ~= (?i)wip actions: merge: method: mergeSchedule
Section titled ScheduleThis format represents a schedule. It can contains only days, only times or both and can have a timezone specified with the times (for the list of available time zones, see IANA format. If no timezone is specified, it defaults to UTC.
schedule = Mon-Frischedule = 09:00-19:00schedule = 09:00-19:00[America/Vancouver]schedule != Mon-Fri 09:00-19:00[America/Vancouver]schedule != SAT-SUNTimestamp
Section titled TimestampThe timestamp format must follow the ISO 8601 standard. If the timezone is missing, the timestamp is assumed to be in UTC. The supported timezones come from the IANA database.
Supported formats:
2021-04-052012-09-17T22:02:512008-09-22T14:01:54Z2013-12-05T07:19:04-08:002013-12-05T07:19:04[Europe/Paris]- name: end of life version 10.0 conditions: - base = stable/10.0 - updated-at <= 2021-04-05 actions: comment: message: | The pull request needs to be rebased after end of life of version 10.0Timestamp Interval
Section titled Timestamp IntervalMergify supports ISO8601 time intervals for some of the exposed attributes.
If the timezone is missing, the timestamp is assumed to be in UTC. The supported timezones come from the IANA database.
2023-07-13T14:00/2023-07-13T16:002023-07-13T14:00:00.123/2023-07-13T16:00:00.1232023-07-13T14:00Z/2023-07-13T16:00Z2023-07-13T14:00/2023-07-13T16:00[Europe/Paris]- name: merge except on new year day conditions: - current-datetime != 2023-01-01T00:00/2023-01-01T23:59[Europe/Paris] actions: merge:Unspecified digits can also be used for some part of the timestamp:
# 14:00 to 19:00 the 14th of July of every yearXXXX-07-14T14:00/XXXX-07-14T19:00[Europe/Paris]
# 14:00 to 19:00 every day of July of every yearXXXX-07-XXT14:00/XXXX-07-XXT19:00[Europe/Paris]
# 14:00 to 19:00 every day of July of 20232023-07-XXT14:00/XXXX-07-XXT19:00[Europe/Paris]
# 14:00 to 19:00 every 31st day of every month of 2023# If a month doesn't have a 31st day it will be skipped2023-XX-31T14:00/2023-XX-31T19:00[Europe/Paris]
# 14:00 to 19:00 every 31st day of every month of every yearXXXX-XX-31T14:00/XXXX-XX-31T19:00[Europe/Paris]Relative Timestamp
Section titled Relative TimestampTimestamps can be expressed relative to the current date and time. The format
is [DD days] [HH hours] [MM minutes] ago :
DD, the number of daysHH, the number of hoursMM, the number of minutes
If the current date is 18th June 2020, updated-at >= 14 days ago is
translated to updated-at >= 2020-06-04T00:00:00.
- name: close stale pull request conditions: - base = main - -closed - updated-at < 14 days 3 hours 2 minutes ago actions: close: message: | This pull request looks stale. Feel free to reopen it if you think it's a mistake.Duration
Section titled DurationDuration can be expressed as quantity unit [quantity unit...] where quantity
is a number (possibly signed); unit is second, minute, hour, day, week, or
abbreviations or plurals of these units;
1 day 15 hours 6 minutes 42 seconds1 d 15 h 6 m 42 sPriority
Section titled PriorityPriority values can be expressed by using an integer between 1 and 10000. You can also use those aliases:
low(1000)medium(2000)high(3000)
priority_rules: - name: my hotfix priority rule conditions: - base = main - label = hotfix - check-success = linters priority: high
- name: my low priority rule conditions: - base = main - label = low - check-success = linters priority: 550Templates
Section titled TemplatesSome fields are rendered as templates before Mergify uses them. Most accept
variable substitution (short {{ name }} placeholders filled with pull
request data); a few still use the legacy Jinja2 language.
Variable substitution
Section titled Variable substitutionSeveral fields let you insert pull request data using variables:
Thank you {{ author }} for your contribution!renders to:
Thank you jd for your contribution!when the pull request author login is jd.
A variable is written as {{ name }} (surrounding spaces are optional). Every
other character is kept as-is. Each templated field accepts a specific set of
variables, documented as its data type below.
Message template
Section titled Message templateUsed by the comment,
review and close
message fields.
The {{ assignees }} and {{ approvers }} variables render as ready-to-use
@-mentions for the pull request’s assignees and the people who approved it.
For example, the template:
Thanks {{ approvers }} for the review!renders to:
Thanks @alice, @bob for the review!when the pull request was approved by alice and bob.
| Variable | Description |
|---|---|
{{ author }} |
The pull request author's login. |
{{ number }} |
The pull request number. |
{{ title }} |
The pull request title. |
{{ body }} |
The pull request description (body). |
{{ base }} |
The base branch name. |
{{ head }} |
The head branch name. |
{{ labels }} |
The pull request's labels as a comma-separated list (e.g. |
{{ assignees }} |
Assignees as a ready-to-use @mention list (e.g. |
{{ approvers }} |
Reviewers who approved, as a @mention list (e.g. |
{{ queue_dequeue_reason }} |
Why the pull request left the merge queue; empty outside queue contexts. |
Title template
Section titled Title templateUsed by the copy and
backport title field.
| Variable | Description |
|---|---|
{{ title }} |
The pull request title. |
{{ number }} |
The pull request number. |
{{ destination_branch }} |
The branch the pull request is copied to. |
{{ base }} |
The base branch name. |
{{ author }} |
The pull request author's login. |
Body template
Section titled Body templateUsed by the copy and
backport body field.
| Variable | Description |
|---|---|
{{ title }} |
The pull request title. |
{{ number }} |
The pull request number. |
{{ destination_branch }} |
The branch the pull request is copied to. |
{{ base }} |
The base branch name. |
{{ author }} |
The pull request author's login. |
{{ body }} |
The pull request description (body). |
{{ cherry_pick_error }} |
The cherry-pick error message, when the copy hit a conflict (body only). |
{{ cherry_picked_commits }} |
The cherry-picked commit SHAs, newline-joined. |
Workflow input template
Section titled Workflow input templateUsed by the github_actions workflow input
values.
| Variable | Description |
|---|---|
{{ author }} |
The pull request author's login. |
{{ number }} |
The pull request number. |
{{ title }} |
The pull request title. |
{{ base }} |
The base branch name. |
{{ head }} |
The head branch name. |
{{ repository_full_name }} |
The repository's full name ( |
A GitHub login. You can also use the {{ author }} variable to target the pull
request author. Used by the assign users,
add_users and remove_users fields.
| Variable | Description |
|---|---|
{{ author }} |
The pull request author's login. |
Assignee
Section titled AssigneeA GitHub login. You can also use {{ author }} (the pull request author) and
{{ merged_by }} (the user who merged the original pull request). Used by the
copy and backport
assignees field.
| Variable | Description |
|---|---|
{{ author }} |
The pull request author's login. |
{{ merged_by }} |
The login of the user who merged the pull request. |
Bot account
Section titled Bot accountA GitHub login Mergify impersonates to perform an action. You can also use the
{{ author }} variable to act as the pull request author. Used by the
bot_account field of the comment,
edit, copy,
merge, rebase,
request_reviews,
review, squash and
update actions, and the merge queue
draft_bot_account, merge_bot_account and update_bot_account.
| Variable | Description |
|---|---|
{{ author }} |
The pull request author's login. |
Legacy template
Section titled Legacy templateThe template data type is a regular string that is rendered using the Jinja2 template language.
If you don’t need any of the power coming with this templating language, you can just use this as a regular string.
However, those templates allow to use any of the pull request attributes in the final string.
For example the template string:
Thank you @{{author}} for your contribution!will render to:
Thank you @jd for your contribution!when used in your configuration file — considering the pull request author
login is jd.
Jinja2 filters are supported, you can build string from list for example with:
Approved by: @{{ approved_reviews_by | join(', @') }}Jinja2 string manipulation are also supported, you can split string for example with:
{{ body.split('----------')[0] | trim }}Mergify also provides custom Jinja2 filters:
markdownify: to convert HTML to Markdown:
{{ body | markdownify }}get_section(<section>, <default>): to extract one Markdown section
{{ body | get_section("## Description") }}GitHub Repository Permissions
Section titled GitHub Repository PermissionsEither none, read, triage, write, maintain or admin.
Queue Dequeue Reason
Section titled Queue Dequeue ReasonThis describes the reason why a pull request’s merge queue checks ended — either because the pull request left the queue, or because its checks were interrupted while it stayed in the queue.
The following reasons can be reported:
| Reason | Description |
|---|---|
none |
The pull request is not, and never was, in a merge queue. |
pr-merged |
The pull request was merged by the merge queue. |
pr-merged-intermediate-results-skipped |
The pull request was merged based on the successful result of a later pull request in the same speculative batch, skipping its own intermediate checks. |
pr-dequeued |
The pull request was removed from the queue, for example because its queue conditions no longer match. |
pr-dequeued-from-partition |
The pull request stopped matching a partition's rules and was removed from that partition. |
pr-ahead-dequeued |
A pull request ahead in the queue was removed, so this pull request's speculative checks are restarted. It stays in the queue. |
batch-ahead-failed |
A batch ahead in the queue failed, so this pull request's speculative checks are restarted. It stays in the queue. |
pr-with-higher-priority-queued |
A higher-priority pull request was queued ahead of this one. It stays in the queue. |
scheduled-freeze-status-changed |
A scheduled queue freeze changed the freeze status of the batch's pull requests, so the batch was split. It stays in the queue. |
speculative-check-number-reduced |
The number of speculative checks was reduced. The pull request stays in the queue. |
checks-timeout |
The configured |
checks-failed |
The queue conditions cannot be satisfied because required checks failed. |
dropped-by-bisection-elimination |
Batch bisection isolated the failure to other pull requests and dropped this one without testing it individually. |
queue-rule-missing |
The queue rule referenced by the pull request no longer exists in the configuration. |
base-branch-missing |
The pull request's base branch no longer exists. |
base-branch-changed |
The pull request's base branch changed. |
pr-unexpectedly-failed-to-merge |
An unexpected error happened while merging the pull request. |
batch-max-failure-resolution-attempts |
The maximum number of |
pr-checks-stopped-because-merge-queue-pause |
The pull request's checks were interrupted because the merge queue is paused on the repository. It stays in the queue. |
conflict-with-base-branch |
The pull request conflicts with its base branch. |
conflict-with-pull-ahead |
The pull request conflicts with a pull request ahead of it in the queue. |
branch-update-failed |
Updating the pull request's head branch failed. |
draft-pull-request-changed |
The merge queue draft pull request received commits that Mergify did not create. |
batch-pull-request-closed |
The merge queue batch pull request was closed. |
pull-request-updated |
The pull request was manually updated. |
merge-queue-reset |
The merge queue was reset. |
incompatibility-with-branch-protections |
The pull request cannot be checked because of an incompatibility between the queue and the repository's branch protections. |
pr-manually-merged |
The pull request was merged manually, outside of the merge queue. |
draft-pull-request-creation-failed |
Mergify could not create the merge queue draft pull request. |
draft-pull-request-creation-branch-not-indexed |
Mergify could not create the merge queue draft pull request because GitHub had not yet indexed the new branch. |
configuration-changed |
The Mergify configuration changed while the pull request was queued. |
unprocessable-pull-request |
Mergify cannot process the pull request, for example because it has too many check runs, comments, or files. |
pr-manually-dequeued |
The pull request was removed from the queue by a |
stack-predecessor-dequeued |
A predecessor pull request in the same stack was dequeued, so this one was removed as well. |
intermediate-results-skipped |
The pull request's intermediate speculative results were skipped. It stays in the queue. |
checks-retried |
The pull request's failed checks are being retried. It stays in the queue. |
schedule-blocked-ahead-yielded |
A pull request ahead that was waiting for its merge schedule yielded its position so ready pull requests behind it can merge first. It stays in the queue. |
base-ref-alignment-timeout |
The pull request could not be retargeted onto the queue base branch, for example a stacked pull request GitHub never retargeted. |
github-stacked-pull-request-merge-unsupported |
The pull request is a GitHub stacked pull request, which GitHub does not support merging through its API. |
Report Modes
Section titled Report ModesReport modes allow you to choose the type of report you want for your actions.
Report mode values can be expressed in the configuration as a list of strings.
The default value is ["check"] and the list can’t be empty.
To fill the list, the following report modes are available:
| Mode | Description |
|---|---|
check | Report the action’s result as a GitHub check on the Pull Request. This is the default report mode. |
comment | Report the action’s result as a comment on the Pull Request |
Report mode option is currently supported for only the following actions: backport, copy.
Was this page helpful?
Thanks for your feedback!