---
title: GitHub Rulesets Compatibility
description: How Mergify interacts with GitHub branch protections and rulesets, including known incompatibilities and how to resolve them.
---

Mergify automatically detects [GitHub branch
protections](https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/managing-protected-branches/about-protected-branches)
and
[rulesets](https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/managing-rulesets/about-rulesets)
configured on your repository and injects the supported ones as conditions.
This page explains how that injection works, which ruleset rule types are
supported, which ones are incompatible with the merge queue, and how to
resolve conflicts.

## Recommended ruleset setup

A ruleset shaped like this works with the merge queue without further tuning.
The rest of this page explains what each point protects you from.

1. **Add Mergify to the bypass list with the `exempt` bypass mode**, on every
   ruleset that applies to a branch you queue or to the queue branches
   (`mergify/merge-queue/*` unless you set
   [`queue_branch_prefix`](/configuration/file-format/#queue-rules)). See
   [Bypass Actors](#bypass-actors).

2. **Require at least one approving review, if you require reviews at all.** At
   an approval count of `0`, Mergify has to rebuild the review gate itself, with
   gaps. See [Review Requirements](#review-requirements).

3. **Leave *Require branches to be up to date before merging* off**, unless you
   use [in-place checks](/merge-queue/batches#in-place-checks-no-batch-prs) or
   the [`fast-forward` merge
   method](/merge-queue/merge-strategies#fast-forward). See [Require Branches to
   Be Up to Date](#require-branches-to-be-up-to-date).

4. **Leave GitHub's native `merge_queue` rule off** on the branches you queue
   with Mergify. See [GitHub Native Merge Queue
   Rule](#github-native-merge-queue-rule).

5. **Keep review requirements off the head branches you queue** if you use
   in-place checks. See [In-Place Checks and Review
   Requirements](#in-place-checks-and-review-requirements).

6. **Re-express anything Mergify does not handle as a rule it does handle**,
   usually a CI check behind a `required_status_checks` rule. See [Ignored Rule
   Types](#ignored-rule-types).

## How condition injection works

When Mergify processes a pull request, it reads the branch protection and
ruleset rules that apply to the target branch and converts them into
[merge conditions](/configuration/conditions). For example, if you require at
least one approved review, Mergify injects the condition
`#approved-reviews-by >= 1`.

This injection happens automatically for both the
[`merge`](/workflow/actions/merge) action and the merge queue.

### Bypass actors

If you are using GitHub rulesets (not classic branch protections), add Mergify
as a **bypass actor** with the **`exempt`** bypass mode on every ruleset that
applies to a branch you queue or to the queue branches. Beyond merging pull
requests, the merge queue works on its own queue branches, and the
[`fast-forward`](/merge-queue/merge-strategies#fast-forward) and
[`merge-batch`](/merge-queue/merge-strategies#merge-batch) merge methods update
the base branch directly (see [Bypass actors and
injection](#bypass-actors-and-injection)). `exempt` covers all of it, and it is
the only mode GitHub accepts for merging
[GitHub-native stacked pull requests](#github-native-stacked-pull-requests).
With `always` or `pull_requests_only`, part of the queue stays blocked.

See [Configuring Mergify as a Bypass
Actor](#configuring-mergify-as-a-bypass-actor) for the steps.

### Bypass actors and injection

The bypass mode decides what GitHub lets Mergify *do*. A `pull_requests_only`
bypass covers only what Mergify does through a pull request: merging it. The
merge queue also updates branches directly, with no pull request involved:

- The [`fast-forward`](/merge-queue/merge-strategies#fast-forward) merge method,
  when it tests in [batch pull
  requests](/merge-queue/merge-strategies#batch-pr-mode), moves the base branch
  onto the batch pull request's head instead of merging it.

- The [`merge-batch`](/merge-queue/merge-strategies#merge-batch) merge method
  can push Mergify's own merge commits to the base branch instead of merging
  the batch pull request.

- The merge queue creates, pushes to and deletes its own queue branches.

GitHub treats each of these updates as a push to the branch, which a
`pull_requests_only` bypass does not cover: the ruleset applies to it in full,
and a rule that requires a pull request refuses it whatever approval count the
rule asks for. Only the `exempt` and `always` modes let it through.

```dot class="flow" title="Under a ruleset that requires a pull request on main, any bypass mode lets Mergify merge a pull request, but only exempt or always lets it move main directly, as the fast-forward and merge-batch merge methods do."
digraph {
  Merge [label="Merge a\npull request", class="mergify"];
  Direct [label="Move main\ndirectly\n(fast-forward,\nmerge-batch)", class="mergify"];
  Lands [label="main updated", class="merged"];
  Refused [label="GitHub refuses\nthe update", class="failed"];

  Merge -> Lands [label=" any bypass\l mode\l"];
  Direct -> Lands [label=" exempt\l or always\l"];
  Direct -> Refused [label=" pull_requests_only\l", class="failed"];
}
```

A `merge-batch` queue asks for the bypass even if it has never pushed a batch:
Mergify knows which batches it can push only once they are ready, so the queue
checks the base branch's rules for a direct update when a
pull request is queued. Give Mergify the `exempt` mode from [Bypass
actors](#bypass-actors), or `always` on GitHub Enterprise Server before 3.20,
which has no `exempt` mode.

What Mergify *requires* before it merges is set by the conditions it
injects from the target branch's rules. To keep a single rule from gating your
queue, take it out of the ruleset or scope the ruleset so it no longer targets
the branch. Narrowing Mergify's bypass mode blocks the queue and leaves the
requirement in place.

## Review requirements

GitHub has no API that answers "is this ruleset satisfied". The closest thing is
the GraphQL `pullRequest.reviewDecision` field, and GitHub only publishes a
decision there when a rule on the base branch requires at least one approving
review. When the required
approval count is `0`, the field stays `null` even while GitHub keeps blocking
the merge. So Mergify reads GitHub's verdict where GitHub publishes one, and
rebuilds the gate from the pull request's own reviews where it does not.

Which of the two applies is decided **per base branch, not per ruleset**. Mergify
takes the highest `required_approving_review_count` across every active
`pull_request` rule on the branch, from classic branch protection and from every
ruleset alike. A single ruleset asking for one approval puts the whole branch on
GitHub's verdict. A ruleset Mergify can bypass counts like any other.

```dot class="flow" title="Two rulesets on main, one asking for no approval and the other for one: the highest count, 1, decides for the whole branch, so github-review-approved reads GitHub's verdict. Only when every rule asks for none does Mergify rebuild the gate from the reviews."
digraph {
  A [label="Ruleset A\nno approval", class="config"];
  B [label="Ruleset B\n1 approval", class="config"];
  Main [label="main: 1 approval\n(the highest count)", class="config"];
  Verdict [label="GitHub's verdict\n(reviewDecision)", class="external"];
  Rebuilt [label="Mergify rebuilds\nthe gate", class="muted", style="rounded,filled,dashed"];

  A -> Main;
  B -> Main;
  Main -> Verdict [label="  at least 1"];
  Main -> Rebuilt [label="  0", class="muted", style=dashed];
}
```

That branch-wide count decides which verdict `github-review-approved` reads.
Whether a given rule also contributes a code owner or last-push condition is
decided from that rule's own count, so a branch on GitHub's verdict can still
carry a local `CODEOWNERS` condition injected by a second rule that requires no
approvals.

Review requirements also collide with two queue features whatever the count. See
[Required pull requests with fast-forward and
merge-batch](#required-pull-requests-with-fast-forward-and-merge-batch) and
[In-Place Checks and Review Requirements](#in-place-checks-and-review-requirements).

### At least one required approval

[`github-review-approved`](/configuration/conditions#github-rulesets-and-branch-protection-attributes)
mirrors `reviewDecision`. GitHub has already applied reviewer eligibility,
`CODEOWNERS` ownership, the rule's own approval-freshness options, and active
change requests, so the condition Mergify evaluates and GitHub's own merge button
agree.

Nothing the rule asks for beyond approvals needs a condition of its own here.
GitHub folds code owner review, approval of the most recent push, review thread
resolution, and the rule's **Required reviewers** into the decision it
publishes, so `github-review-approved` answers for all four and Mergify injects
nothing alongside it. The one exception is a rule with a **Required reviewers**
entry scoped to a subset of files, which keeps that condition. See [Required
Reviewers](#required-reviewers).

If Mergify cannot read the decision at all, it treats the pull request as not
approved rather than merging it.

### No required approval

At `required_approving_review_count: 0`, a `pull_request` rule still enforces its
other requirements, a blocking review, code owner review, and approval of the most
recent push, against anyone who cannot bypass it. GitHub just stops publishing a
verdict, so Mergify rebuilds most of them from the pull request's reviews.

Each requirement Mergify does rebuild is deliberately fail-safe: it can hold a
pull request GitHub would have let through, and it never lets one merge that
GitHub would have blocked. The symptom is a pull request Mergify is still waiting
on while GitHub reports it as mergeable.

| Requirement | Enforced by Mergify at `0` approvals | Where Mergify differs from GitHub |
|---|---|---|
| A blocking review | Yes | Stricter: reviewer eligibility is approximated by a write-access check |
| Code owner review | Yes | Stricter: an owner that resolves to no GitHub login can never satisfy its file |
| Approval of the most recent push | **No** | **Looser: a pull request can merge with an unapproved latest push** |

:::caution
  Approval of the most recent push is the only review requirement on this page
  that a pull request can merge without. Require at least one approving review
  on the rule if the latest push must be approved before a merge.
:::

**A blocking review.** `github-review-approved` is `false` while a reviewer with
write access or above has an active *Request changes*. Only each reviewer's most
recent review counts, and bot reviews are advisory. Mergify approximates
GitHub's reviewer eligibility with that write-access check, so it can hold a
pull request on a review GitHub would disregard.

**Code owner review.**
[`github-code-owner-review-satisfied`](/configuration/conditions#github-rulesets-and-branch-protection-attributes)
reads `CODEOWNERS` itself: for each file the pull request touches it takes the
owners of the last matching entry, and is satisfied when one of them approved and
none requested changes. Both paths of a rename count. An owner it cannot resolve
to a GitHub login, such as a bare email address or a team in another
organization, can never satisfy the file, so its approval does not count. When no
owner of a file resolves, the check summary names the entry; when another owner
does resolve, the pull request waits for that owner's approval with nothing to
say why.

**Approval of the most recent push.** Mergify does not inject
`github-require-last-push-approval` when the required approval count is `0`.
GitHub keeps blocking anyone who cannot bypass the rule, but where Mergify
bypasses it, as the [bypass actor](#bypass-actors) setup this page recommends,
nothing checks the latest push. Requiring at least one approving review is what
makes Mergify honor the option.

**Reviews from named teams or users.** This is the rule's **Required
reviewers** setting. At `0` approvals GitHub publishes no verdict for it either,
so Mergify evaluates `github-require-review-from-specific-teams` itself, as
covered in [Required Reviewers](#required-reviewers). A team or user ID the
ruleset names but Mergify cannot resolve makes the condition `false`, so the
misconfiguration blocks instead of being skipped.

### Required reviewers

A `pull_request` ruleset rule can require approvals from specific teams or
users (the rule's **Required reviewers** setting). Mergify detects this and
injects the
[`github-require-review-from-specific-teams`](/configuration/conditions#github-rulesets-and-branch-protection-attributes)
boolean condition, so a pull request is merged only once those approvals are
in. A rule that also requires at least one approving review gets the condition
only when one of its entries is scoped to a subset of files: GitHub folds the
entries that cover every file into the verdict
[`github-review-approved`](#at-least-one-required-approval) reads.

The condition is `true` when every required reviewer is satisfied:

- each required **team** has at least the requested number of approvals from
  its members, and

- each required **user** has approved the pull request.

When the requirement is scoped to a subset of files (the ruleset's
`file_patterns` field), it only applies to pull requests that touch a matching
file. Other pull requests are unaffected.

Mergify injects this condition itself, and you cannot write it in your own
conditions: a configuration that references it is rejected when it is
validated.

:::note
  The condition evaluates to `false` if a ruleset entry points to a team or
  user that no longer exists, so the misconfiguration surfaces instead of
  being silently skipped. Fix the ruleset to remove the stale reviewer.
:::

## Ruleset rule compatibility

Mergify handles each GitHub ruleset rule type as follows.

| Ruleset rule type | Mergify behavior | Notes |
|---|---|---|
| `required_status_checks` | Injected as conditions | See [below](#require-branches-to-be-up-to-date) |
| `pull_request` | Injected as conditions | Depends on the approval count. See [above](#review-requirements) |
| `merge_queue` (GitHub native) | **Incompatible** | See [below](#github-native-merge-queue-rule) |
| `creation` | Checked on queue branch creation | See [below](#required-signatures-and-branch-deletion) |
| `update` | Checked on queue branch creation | See [below](#required-signatures-and-branch-deletion) |
| `branch_name_pattern` | Checked on queue branch creation | See [below](#branch-name-pattern) |
| `required_signatures` | Compatible on the hosted service | See [below](#required-signatures-and-branch-deletion) |
| `deletion` | Checked on queue branch creation | See [below](#required-signatures-and-branch-deletion) |
| All other rule types | Ignored | See [below](#ignored-rule-types) |

Mergify supports only the ruleset rule types named above. Every other rule
type is ignored: Mergify does not inject it as a condition. Do not assume full
ruleset parity. See [Ignored Rule Types](#ignored-rule-types) for how to enforce
a rule Mergify does not handle, and for the one of them it does check.

`required_review_thread_resolution` is an option on the `pull_request` rule, not
a rule type of its own, so it has no row above. Mergify injects
`#review-threads-unresolved = 0` for it alongside the [review
conditions](#review-requirements) that rule contributes, as long as the rule
requires no approving review; at one approval or more GitHub folds thread
resolution into the verdict
[`github-review-approved`](#at-least-one-required-approval) reads. Classic
branch protection's `required_conversation_resolution` gets the condition at any
approval count.

:::caution
  Branch protection support has some limitations. For example, GitHub does
  not provide an API to support [code
  owners](https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners),
  which makes it unreliable in certain circumstances.
:::

## Known incompatibilities

### GitHub-native stacked pull requests

Merging [GitHub-native stacked pull
requests](/merge-queue/stacks#github-native-stacked-pull-requests) requires
the `exempt` bypass mode. With any other bypass mode, the merge queue refuses
the pull request.

**Resolution:**

- Set Mergify's bypass mode to **Exempt** on every ruleset that applies to
  the base branch.

### GitHub-native merge queue rule

If the `merge_queue` ruleset rule (GitHub's built-in merge queue) is enabled
on the target branch and Mergify is **not** a bypass actor, GitHub blocks
Mergify from merging pull requests -- all merges must go through GitHub's own
queue.

**Resolution:**

- **Preferred:** disable the `merge_queue` ruleset rule on branches where you
  use Mergify's merge queue.

- **Alternative:** add Mergify as a bypass actor on that ruleset with the
  `exempt` bypass mode. This lets Mergify merge directly while GitHub's queue
  is still active for other actors.

### Branch name pattern

If a `branch_name_pattern` ruleset rule matches Mergify's queue branches, GitHub
blocks Mergify from creating them unless Mergify bypasses the ruleset. As a
result, Mergify cannot queue or merge pull requests targeting that branch.

Queue branches are prefixed with `mergify/merge-queue/`, customizable via
`queue_branch_prefix` in
[`queue_rules`](/configuration/file-format/#queue-rules). The error Mergify
reports names the queue branch that was refused, so you know which pattern to
narrow.

**Resolution:**

- **Preferred:** add Mergify as a bypass actor on the ruleset with the
  `exempt` bypass mode.

- **Alternative:** narrow the ruleset pattern so it excludes
  `mergify/merge-queue/*`. If you customized
  [`queue_branch_prefix`](/configuration/file-format/#queue-rules), substitute
  your prefix.

:::note
  Mergify also periodically deletes leftover queue branches that match these
  prefixes. See [Queue branch
  cleanup](/merge-queue/lifecycle#queue-branch-cleanup) for how branches are
  matched and an important caveat about naming your own branches.
:::

### Required signatures and branch deletion

Mergify builds each queue branch itself and pushes it, then deletes it once
the batch is done. Neither goes through a pull request, so a ruleset covering
the queue branch prefixes applies to both.

On the hosted service, a `required_signatures` rule on the queue branches works
without a bypass. Mergify signs the merge commits it adds to a queue branch and
commits them as `Mergify <commit-signer@mergify.com>`, so GitHub shows them as
**Verified**. With the [`merge-batch` merge
method](/merge-queue/merge-strategies#merge-batch), or `fast-forward` in
[batch-PR mode](/merge-queue/merge-strategies#batch-pr-mode), these commits
land on your base branch, and a signature rule there accepts them too.

The rule can still refuse a push in these cases:

- **A queued pull request carries unsigned commits.** When Mergify creates a
  queue branch, GitHub checks the commits that are on no other branch of the
  repository yet, typically those of a pull request opened from a fork. If one
  of them is unsigned, GitHub rejects the push and the queue reports the
  refusal. Have the author sign those commits and push again before requeuing,
  rather than adding a bypass that would let them past your signature policy.

- **Another Mergify action writes the commits.** The
  [`squash`](/workflow/actions/squash), [`backport`](/workflow/actions/backport)
  and [`copy`](/workflow/actions/copy) actions write unsigned commits.
  `backport` and `copy` push them to new branches under `mergify/`, so a
  signature rule covering that namespace rejects those pushes. `squash`
  force-pushes the pull request's own branch as a GitHub user, so a signature
  rule covering that branch rejects it unless that user can bypass the rule.

- **Mergify runs on-premise.** An [on-premise installation](/enterprise) does
  not sign its queue commits, so a `required_signatures` rule on the queue
  branches would reject every push. The queue reports the conflict before it
  tries to push.

If one of your workflows verifies signatures against its own keyring, for
example with `git verify-commit` or `git log --format='%G?'`, add Mergify's
public key from
[github.com/mergify-commit-signer.gpg](https://github.com/mergify-commit-signer.gpg)
to it. Keep GitHub's key from
[github.com/web-flow.gpg](https://github.com/web-flow.gpg) there too: it signs
the commits GitHub creates for Mergify, such as the merge into your base branch.
Fetch Mergify's key from that address rather than pinning a copy, since the
signing key is rotated.

The other rules a ruleset can apply to the queue branches stop the queue
wherever Mergify runs:

- A `deletion` rule stops Mergify from removing a queue branch, so it cannot
  manage its queue branches at all. The queue reports this as it prepares
  the batch, not later when a branch would have been deleted.

- A `creation`, `update`, or `pull_request` rule refuses the queue branch
  outright, whatever the rule itself asks for. A `pull_request` rule counts
  here because the queue branch is pushed, never opened as a pull request of
  its own, so the rule can never be satisfied on it.

The resolution below covers these rules, and the unsigned pushes of an
on-premise installation or of the `backport` and `copy` actions.

**Resolution:**

- **Preferred:** add Mergify as a bypass actor on the ruleset with the
  `exempt` bypass mode.

- **Alternative:** narrow the ruleset so it does not cover the queue branch
  prefixes, or the `mergify/` branches the `backport` and `copy` actions
  create.

### Require branches to be up to date

The `strict_required_status_checks_policy` setting (labeled *Require branches
to be up to date before merging* in the GitHub UI) is incompatible with
[parallel checks](/merge-queue/performance#parallel-checks) and
[batches](/merge-queue/batches) when using batch PR checks.

Mergify creates temporary batch PRs to test combined changes. The
original pull requests are merged after those checks pass, but GitHub
considers them "not up to date" because they were not the branches that were
tested. This setting blocks the merge.

:::note
  Disabling this setting does **not** mean Mergify tests outdated code.
  Mergify always updates pull requests against the latest base branch before
  testing.
:::

**Resolution:**

- **Preferred:** disable the *Require branches to be up to date before
  merging* setting.

- **Alternative:** add Mergify as a bypass actor on the ruleset with the
  `exempt` bypass mode.

- **Alternative:** use the [`fast-forward` merge
  method](/merge-queue/merge-strategies#fast-forward), which merges the queue
  branch directly and is not affected by this setting.

- **Alternative:** use [in-place checks](/merge-queue/batches#in-place-checks-no-batch-prs),
  which test PRs on their own branch without creating temporary batch PRs. Note
  that in-place checks require `batch_size: 1`, `max_parallel_checks: 1` and
  serial mode, so this resolution means giving up the batches or parallel checks
  that caused the conflict rather than keeping them.

{/* Keeps links to the section's former name, Review Requirements and Fast-Forward, landing here. */}
<span id="review-requirements-and-fast-forward"></span>

### Required pull requests with fast-forward and merge-batch

A `pull_request` ruleset rule on the base branch is incompatible with the
[`merge-batch` merge method](/merge-queue/merge-strategies#merge-batch), and
with [`fast-forward`](/merge-queue/merge-strategies#fast-forward) when it tests
in [batch pull requests](/merge-queue/merge-strategies#batch-pr-mode), unless
Mergify bypasses the rule with the `exempt` or `always` mode. Both move the base
branch directly, onto commits no pull request merged, and GitHub refuses that
update under any rule that requires a pull request, even one that requires no
approving review. A `pull_requests_only` bypass does not cover it: see [Bypass
actors and injection](#bypass-actors-and-injection) for why. A classic branch
protection with **Require a pull request before merging** refuses the update
the same way.

Both queues refuse a pull request when it is queued, before its CI runs, and
name the ruleset or branch protection to change.

**Resolution:**

- Add Mergify as a bypass actor with the `exempt` bypass mode on every ruleset
  that has a `pull_request` rule on the base branch.

- With a classic branch protection, allow Mergify to **bypass the required
  pull requests** setting.

### In-place checks and review requirements

When using [in-place checks](/merge-queue/batches#in-place-checks-no-batch-prs)
(where Mergify tests a PR on its own branch), a `pull_request` ruleset rule
that enforces review requirements on the PR's **head** branch stops Mergify
from checking the PR, and the queue reports an incompatibility error. Adding
Mergify as a bypass actor does not resolve it, since the check looks at whether
the rule is set rather than at who may bypass it. PRs opened from a fork are
not affected.

**Resolution:**

- Drop the review requirement from the ruleset that targets the head branches
  you queue, or stop using in-place checks on that queue.

## Ignored rule types

The following ruleset rule types are not injected as conditions. If these rules
are active on your branches, Mergify does not enforce them itself:

- `required_deployments`

- `required_linear_history`

- `non_fast_forward`

- Pattern and file rules (`commit_message_pattern`,
  `commit_author_email_pattern`, `committer_email_pattern`,
  `file_path_restriction`, `max_file_path_length`,
  `file_extension_restriction`, `max_file_size`)

- `workflows`

- `code_scanning`

Mergify as a [bypass actor](#bypass-actors), which the [recommended
setup](#recommended-ruleset-setup) calls for, covers the whole ruleset, so GitHub
does not apply these rules to a merge the queue performs either. If you rely on
one of them, put the requirement behind a CI check and require that check with a
`required_status_checks` rule, which Mergify does inject, so your branch rules
stay in the ruleset. Fall back to a [merge
condition](/configuration/conditions) only for a requirement no ruleset rule can
express.

Two of them need a different answer. `required_linear_history` and
`non_fast_forward` constrain the ref update rather than the pull request, so no
condition reproduces them. GitHub still enforces both against every other
actor; to keep the queue's own merges linear, pick
[`merge_method: squash` or `rebase`](/merge-queue/merge-strategies).

`required_linear_history` is also the one rule in this list Mergify checks for
compatibility, on a [`fast-forward`](/merge-queue/merge-strategies#fast-forward)
queue that tests in batch pull requests. That queue moves the base branch onto
the batch pull request's head, which carries one merge commit per pull request,
so a linear-history rule on the base branch can never accept it: the queue
reports the incompatibility instead of pushing. The same check covers a
`required_signatures` rule on the base branch while the commits are unsigned,
as they are on an [on-premise installation](/enterprise).

## Configuring Mergify as a bypass actor

To add Mergify as a bypass actor on a GitHub ruleset:

1. Go to your repository **Settings > Rules > Rulesets**.
2. Select the ruleset you want to modify (or create a new one).
3. Under **Bypass list**, click **Add bypass**.
4. Search for the **Mergify** app and select it.
5. Choose **Exempt** as the bypass mode.
6. Save the ruleset.

Bypass actors are configured per ruleset, so repeat this on every ruleset
that applies to the branches you queue or to the queue branches.

GitHub Enterprise Server offers the **Exempt** mode from version 3.20. On an
older version, choose **Always allow**: it covers everything the merge queue
does except [GitHub-native stacked pull
requests](#github-native-stacked-pull-requests).
