View as Markdown

Enabling & Configuring Merge Protections

How to enable Merge Protections, pick a reporting method, and decide whether the check needs to be required in GitHub.


  1. Go to the Mergify dashboard
  2. Click the Merge Protections section
  3. Select your repository
  4. Activate the product, then create rules under Rules
Merge Protections rules for a repository

The rules themselves live in your repository’s configuration file, under the merge_protections key. The dashboard’s rule builder is an editor for that file: it opens a pull request adding your rules to it. You can write them by hand instead. See Custom Rules for the rule structure.

Reporting method: check-runs vs deployments

Section titled Reporting method: check-runs vs deployments

You can configure how Merge Protections report their status to GitHub using the reporting_method option in your configuration. This controls whether the protection status appears as a GitHub Check Run or as a Deployment.

  • check-runs (default): Reports the protection status as a standard GitHub check on the pull request. This is the most common and compatible method.

    GitHub required checks
  • deployments: Reports the protection status as a GitHub Deployment. This can be useful if your workflow or compliance requirements rely on deployment status. Unlike a check from Mergify’s GitHub App, a required deployment can be passed by anyone with write access to the repository. See Make the check required.

    Merge Protections deploy success

Example configuration:

.mergify.ymlyaml
merge_protections_settings:
reporting_method: check-runs # or deployments
# Post a comment with details about required rules
post_comment: true
# Automatically merge or queue PRs when all protections pass
auto_merge_conditions: true

auto_merge_conditions makes Mergify merge or queue a pull request once its merge protections pass, and auto-merge stays off while the field is omitted. See Auto-Merge for what it accepts and how it behaves.

Enabling inserts a check named Mergify Merge Protections on each pull request, or a deployment of the same name if you set reporting_method: deployments.

Mergify enforces your protections on every merge it performs itself, whether it comes from the merge queue, Auto-Merge, or the merge action: it won’t merge a pull request until all of its active merge protections succeed. You don’t have to require the check in GitHub for that to happen.

Requiring it in GitHub is what blocks a merge that doesn’t go through Mergify: someone clicking GitHub’s merge button, or another tool calling GitHub’s merge API. Unless every merge on the repository goes through Mergify, mark the result as required, as a check or as a deployment depending on your reporting method:

  • GitHub Branch Protection: Settings → Branches → Add/Edit rule → Require status checks / deployment to succeed → select Mergify Merge Protections

  • GitHub Rulesets: Settings → Rules → Select ruleset → Add required status check / deployment to succeed → Mergify Merge Protections

For a check, pick Mergify’s GitHub App as its source instead of any source, and GitHub accepts only the check Mergify posts. A required deployment has no source: anyone with write access to the repository, including a workflow or app with the deployments: write permission, can post a successful Mergify Merge Protections deployment and then merge while your protections are pending or failing.

GitHub Branch Protection

Mergify explains every active protection, failing or not: in the check’s output when you report as check runs, and in a summary comment on the pull request unless you set post_comment: false in merge_protections_settings. Mergify keeps that comment up to date as the pull request is re-evaluated and deletes it once no protection applies.

  • Safe to edit live; re-evaluations happen automatically.
  • Renaming a rule only changes display text; logic is defined by the condition blocks.
  • Remove obsolete rules to keep explanations short.

Was this page helpful?