Merge queue

Connect GitHub, choose repos, run the readiness check, pause the queue, and read the capacity numbers.

What it doeslink

The merge queue merges your pull requests for you, safely. Instead of each pull request being tested alone against an older copy of your main branch, the queue stacks the waiting pull requests together on top of the current main branch, runs your own CI on that combination, and merges each pull request only when the exact combination that will land has passed. If something fails, the queue works out which pull request caused it, sets that one aside with a comment, and carries on with the rest.

You keep your CI, your required checks and your branch rules. The queue adds the ordering, the testing of combinations, and the merging.

The queue builds its test combinations on branches matching mq/**, which the queue owns. They are deleted when the batch ends.

Connect GitHub to your organizationlink

Only an organization owner or admin can do this. Other members can see the page but not change anything.

  1. In the dashboard, open Merge queue and choose Connect a GitHub account.
  2. GitHub opens. Choose the GitHub organization (or your own account) and the repos the queue may use, then install the App.
  3. GitHub sends you back to the dashboard, and the account shows as connected.

To make sure the right person connects the right account, we check with GitHub that you are an admin of that GitHub organization (or the account's own user). If you are not, the connection is refused and you are asked to have an org admin do this step.

A GitHub account can be connected to one organization at a time. If it is already connected elsewhere, its admins must disconnect it first.

Disconnect removes the account and its repos from the queue. It does not remove the App from GitHub; uninstall it there if you want it gone.

Add a repo and choose its settingslink

Under your connected account, add a repo by picking it from a list of the repositories the Merge Queue app can see, then its base branch from that repo's branches (the repo's default branch is chosen for you). The lists load by themselves when you choose the account or the repo. If GitHub cannot be reached, the form says so and lets you type the repo name (without the owner, for example api) and the branch instead. Each repo and branch is added once, even if your GitHub account is renamed later: the queue follows the rename on its own and your settings, queued pull requests and history stay. The repo page walks you through six numbered steps, each marked Done, Current or Later: connect GitHub, add the repo, required checks, readiness check, turn on, and your first pull request. Label, merge method, merge mode, batch limit and the two checkboxes below sit under Advanced in the Turn on step. Open the repo to change its settings:

  • Label that queues a pull request. The label you add to a pull request to put it in the queue. The default is merge-when-ready.
  • How pull requests are merged. Merge commit, squash, or rebase.
  • Merge mode. Fast-forward (recommended) lands each tested combination as it was tested. It needs the merge commit method. If you use squash or rebase, choose One at a time, which merges pull requests individually after they pass.
  • Most batches testing at once. A limit on how many batches run your CI at the same time. Leave it empty for no limit. Each batch is a run of your CI.
  • Required checks. Not asked for by default. The queue reads the checks GitHub requires on your base branch (rulesets and branch protection), so it works with any CI, including CircleCI, and the page shows what it found at the GitHub rules step. Choose Set required checks manually only when you want a different set; add or remove check names as chips and save. Use GitHub's rules instead goes back. If GitHub requires none and you set none, pull requests wait with a message saying so. See Required checks and batch checks.
  • Batch checks (optional). The checks that judge each tested combination. Leave empty and the readiness check works them out. Shown once you choose to set checks manually. See Required checks and batch checks.
  • Require Greenlight approval before a pull request can merge. Holds each pull request until it has been approved. If an enabled QA Teammate on any of your agent servers is in Approve at the threshold mode, this is always on and shown as read-only; it cannot be turned off, and repos that had it off are switched on within about 15 minutes, whether or not anyone opens the page. Pull requests already waiting in the queue without an approval leave it with "approval lost" and rejoin once approved. A QA Teammate that is off or in comment-only mode does not force it, and you choose. If the QA Teammate is later removed, turned off or switched to comment-only, the setting stays on until an owner or admin unticks it.
  • Hold pull requests that have unresolved review threads. On by default. A pull request with any unresolved review thread waits, with the reason shown, until the threads are resolved. Untick it to let pull requests merge regardless of open threads.
  • Only the queue merges to the base branch. Recommended if other people or bots can push to the base branch.

Changing the label, merge method, merge mode, required checks or batch checks, or changing the checks GitHub requires on your base branch, means the readiness check runs again before you can turn the queue on.

Required checks and batch checkslink

The queue uses two sets of checks, because some checks only run on a pull request and never on the branches the queue tests.

  • Required checks gate each pull request. A pull request enters the queue only when every one of them is green on its latest commit. This is usually what GitHub requires on your base branch, for example a review or grader check that runs on pull requests.
  • Batch checks judge each combination the queue builds. They are the checks that actually run on the queue's test branches, which are named mq/.... A batch merges only when all its batch checks pass.

You do not have to sort them yourself. The readiness check pushes a test branch, sees which checks report on it, and shows two lists on the repo page: Judge each batch (the batch checks) and Pull request only (required checks that never ran on the test branch). A required check that is pull-request-only is not a problem; it still has to be green on the pull request before it can queue.

The readiness check first looks at which check names appeared on your recent base-branch commits and on your recent merged pull requests. A required check that has only ever appeared on pull requests is treated as pull-request-only at once and is not waited for, so a typical setup finishes in about a minute. With no history to read, the check waits until every check that reported has finished and nothing new has finished for 5 minutes, so a required check that starts late is still counted. While it runs the page shows what has reported, what has not been seen yet, what is pull-request-only and how long it will keep waiting. It needs your CI to report from a single source, such as one CI app. If checks from several apps reported and none of your required checks is among them, it lists each source's checks and asks you to choose them in the Batch checks field.

If the check finds nothing that reports on the test branch, or GitHub requires no checks on your base branch and you have set none here, it shows Needs attention. Set the Batch checks field when you want to choose them yourself: every check you name must report on the test branch. Changing it makes the readiness check run again.

The readiness checklink

The readiness check proves your repo works with the queue before any real pull request depends on it. It pushes a test branch and checks that your CI reports on it (see Required checks and batch checks). It runs by itself, and the page shows a running state until it finishes. The result shows Passed or Needs attention, when it ran, and a list of anything it found, each with a one-line fix. It also lists anyone else who pushed to the base branch in the last 30 days, since a push you did not expect can break a tested combination.

If you change a setting afterwards, the result is marked as out of date and the check runs again.

When the check fails, it retries by itself after 10 minutes, then 30 minutes, then 2 hours, and the page shows when the next try is. After that it stops, and the page says so. An owner or admin can press Run again on a failed result at any time to start over. The button appears only while the result shows Needs attention. If the dashboard cannot reach the queue when you add a repo, change a setting or press Run again, the page says the check may start up to 6 hours late; it still starts by itself.

Before you turn it onlink

The readiness check cannot see inside your CI configuration or your GitHub settings, so an owner or admin confirms these under Before you turn it on:

  • None of your workflows deploy a branch just because it is not main.
  • Restricted contexts do not hide secrets that the queue's test builds need.
  • Workflows that run only when certain files change compare against the base branch, not the previous commit.
  • "Prevent unregistered users" allows the merge queue bot.
  • Workflows that run on every push skip branches matching mq/**, which the queue owns, or you are fine with them running there.
  • Anything that commits straight to the base branch, such as a release bot, goes through the queue.

If one does not hold, fix it in your CI first. The queue can be turned on only after the list is confirmed and the readiness check has passed.

Turn it on, off, or remove a repolink

Once the list is confirmed and the readiness check has passed, choose Turn on. The queue starts merging for real on its next run, so turn it on only when you are ready for it to merge. The badge reads Starting until its first run, then Live. Turn off switches the repo off. Remove repo switches it off and takes it off your list.

Merge when ready, and the hold labellink

Add the queue label (merge-when-ready by default) to a pull request as soon as you open it, even while checks are still running. It means "merge this as soon as it qualifies". A pull request qualifies when:

  • every check on its latest commit has passed, and your required checks have passed;
  • it has the approval you require, if you turned that on;
  • it has no unresolved review threads, unless you turned that check off under Advanced;
  • it is not a draft, has neither the merge-queue:hold nor the hold label, and has no conflict with the base branch.

Being behind the base branch is not a problem. The queue tests the combination itself. A new push means the pull request has to qualify again.

To keep a labelled pull request out of the queue for a while, add the merge-queue:hold label, or the shorter hold label. Either one holds the pull request. Remove it to let the pull request back in. Removing the queue label takes it out entirely.

While a labelled pull request is blocked, the queue says why: a merge-queue-blocked status on the pull request (for example "queued, blocked: check ci: pending") and the same reason next to it in the repo page's waiting list. It updates when the reason changes and turns green when nothing is blocking.

If a pull request conflicts with the base branch or with another pull request in the same batch, the queue leaves it out of that batch and tells you with a comment. It stays labelled and tries again on the next batch. If a pull request breaks the tests, it is set aside with a comment naming the failing checks, and it stays out until you push a new commit and add the label again.

Pause the queuelink

Pausing stops new batches from starting. It does not merge anything and does not remove anything from the queue.

  • Pause a repo. Open the repo and choose Pause, then Resume when ready. The queue also pauses a repo by itself when something needs a person, for example if your CI does not start for too long or the base branch is red. The reason shows on the page.
  • Pause all repos. On the Merge queue page, an owner or admin can choose Pause all repos to stop every repo in your organization at once, and Resume all to start again.

Pausing and resuming are recorded in your organization's audit log.

The live queue and capacity numberslink

Open a repo to see what the queue is doing now: the batches being tested, any pull request being checked on its own to find a failure, the pull requests waiting, and any that were removed with what to do about them. The page refreshes by itself.

The Capacity section shows what your CI lets the queue carry. It appears once the queue has tested a few pull requests; until then it says it is collecting data.

  • Measured ceiling. About how many pull requests per hour the queue can merge with your current CI time, failure rate and batch size. Faster CI, fewer failures and bigger batches raise it.
  • Failure rate. The share of recent pull requests that failed their tests. A small starting allowance keeps the number steady early on.
  • Flaky reruns. How many times a failed run passed when retried. A flaky check counts as passed but costs you CI time.
  • Your CI time. The typical time from the queue starting a batch to your CI's last result, over recent batches.

If the number of pull requests you add per hour gets close to the ceiling, the page warns you before the queue falls behind. If your CI is slow to start builds, the queue tests fewer batches at once, and the page says it is limited by your CI and how many batches it is running at a time. Speeding up how quickly your CI starts, or reducing flaky checks, lifts the limit.

Who can do whatlink

Action Owner or admin Other members
See the queue, repos and capacity Yes Yes
Connect or disconnect a GitHub account Yes No
Add or remove a repo, change settings Yes No
Confirm the checklist, turn a repo on or off Yes No
Pause or resume a repo or the whole organization Yes No

If something looks wronglink

  • A pull request is not entering the queue. Check that it has the queue label and none of the blockers above, including a merge-queue:hold or hold label and unresolved review threads (see the unresolved-threads setting under Advanced if you want that check off).
  • The repo shows paused and you did not pause it. The page gives the reason. Fix it, then choose Resume.
  • The readiness check needs attention. The list under the result says what to fix. The check runs again after you change settings.
  • Capacity says "Collecting data". The queue needs to test a few pull requests before it can measure your CI. This clears on its own.

See Troubleshooting for general help, or contact support from the dashboard.


Build your team.

Your first AI Teammate, working by end of day.

Get product updates by email

What we shipped and what we learned.

Product updates, a few times a quarter. Unsubscribe any time. Privacy

Protected by reCAPTCHA. Privacy · Terms