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

method

string

merge

Merge method to use. Possible values are merge, squash, rebase or fast-forward.

rebase_fallback

string

merge

If method is set to rebase, but the pull request cannot be rebased, the method defined in rebase_fallback will be used instead. Possible values are merge, squash, none. none will report an error if rebase is not possible.

merge_bot_account

Template

Mergify can impersonate a GitHub user to merge pull request. If no merge_bot_account is set, Mergify will merge the pull request itself. The user account must have already been logged in Mergify dashboard once and have write or maintain permission.

commit_message_template

Template

Template to use as the commit message when using the merge or squash merge method. Template can also be defined in the pull request body (see Defining the Commit Message).

โ›“๏ธ Defining Pull Request Dependencies๐Ÿ”—

Open Source
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 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 %}