merge๐
The merge
action merges the pull request into its base branch.
Mergify always respects the branch protection settings. When the conditions
match and the merge
action runs, Mergify waits for the branch protection to
be validated before merging the pull request.
Mergify also waits for dependent pull requests to get merged first (see โ๏ธ Defining Pull Request Dependencies).
Options๐
Key Name |
Value Type |
Default |
Value Description |
---|---|---|---|
|
Template to use as the commit message when using the |
||
|
Mergify can impersonate a GitHub user to merge pull request.
If no |
||
|
string |
|
Merge method to use. Possible values are |
|
bool |
false |
Allow merging Mergify configuration change. |
โ๏ธ Defining Pull Request Dependencies๐
Feature ๐
You can specify dependencies between pull requests from the same repository.
Mergify waits for the linked pull requests to be merged before merging any pull
request with a Depends-On:
header.
To use this feature, adds the Depends-On:
header to the body of your pull
request:
New awesome feature ๐
To get the full picture, you may need to look at these pull requests:
Depends-On: #42
Depends-On: https://github.com/organization/repository/pull/123
Warning
This feature does not work for cross-repository dependencies.
Warning
If the dependency happens between pull requests targeting different branches, the evaluation of the dependent will not be automatic. You might need to use the refresh command to make Mergify realize the dependency has been merged.
๐ Defining a minimum date to merge๐
Feature ๐
You can specify a date after which you want a pull request to be merged with a Merge-After:
header.
Mergify will wait for the date and time to be passed before merging your pull request.
To use this feature, add the Merge-After:
header to the body of your pull request, followed by the date, with optionally a time and/or a timezone.
If no timezone is specified it will be set to UTC
.
Here are the possible formats:
# Year-Month-Day
Merge-After: 2023-04-18
# Year-Month-Day[Timezone]
Merge-After: 2023-04-18[Australia/Sydney]
# Year-Month-Day Hours:Minutes
Merge-After: 2023-04-18 18:20
# Year-Month-Day Hours:Minutes[Timezone]
Merge-After: 2023-04-18 18:20[Australia/Sydney]
For the list of available time zones, see IANA format.
Defining the Commit Message๐
When a pull request is merged using the squash
or merge
method, you can
override the default commit message. To that end, you need to set
commit_message_template.
You can use part of the pull request body in the Commit Message
Markdown section,
by setting it to:
{{ body | get_section("## Commit Message") }}
Then in the pull request body you can use:
## Commit Message
My wanted commit title
The whole commit message finishes at the end of the pull request body or
before a new Markdown title.
The whole commit message finishes at the end of the Markdown section.
You can use any available attributes of the pull request in the commit message, by writing using the templating language:
For example:
## Commit Message
{{title}}
This pull request implements magnificient features, and I would like to
talk about them. This has been written by {{author}} and has been reviewed
by:
{% for user in approved_reviews_by %}
- {{user}}
{% endfor %}
Check the Template for more details on the format.
Or you can also mix template from the configuration and the pull request body by setting commit_message_template to:
{{ body | get_section("## Commit Message") }}
{% for user in approved_reviews_by %}
- {{user}}
{% endfor %}
{% for label in labels %}
- {{label}}
{% endfor %}