Turning on a merge queue is one setting. Making CI behave inside it is the part that needs thought: which checks run on the pull request, which run in the merge group, and what happens to the ones you skip. This is the CI side only, checked against GitHub’s merge queue docs. The settings page and the enable steps are in GitHub merge queue, explained.
What a GitHub merge group is
When you add a pull request to the queue, the queue groups its changes with the latest version of the base branch and the pull requests ahead of it. That combination is the merge group, and GitHub fires the merge_group event for it. In the run, GITHUB_SHA is the merge group’s SHA and GITHUB_REF is its ref, so the job tests the combined code that’s about to land. The queue merges only once your required checks pass there.
The event is separate from pull_request and push. A workflow that doesn’t list it never runs for queued pull requests, the required check never reports, and the pull request leaves the queue when the status check timeout runs out. That’s the same failure as a check stuck at Expected, just inside the queue.
Merge queue CI: what runs where
Without any changes, every workflow on both events runs in full twice for each pull request. Usually you want fast feedback on the pull request and the expensive suite in the queue, where it tests what main is about to become. One workflow does both:
name: ci
on:
pull_request:
branches: [main]
merge_group:
types: [checks_requested]
branches: [main]
jobs:
lint-and-unit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: npm ci && npm run lint && npm test
e2e:
if: github.event_name == 'merge_group'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: npm ci && npm run test:e2eBoth jobs can be required checks. On the pull request, e2e is skipped by its conditional, and per GitHub’s required checks troubleshooting page a job skipped that way reports Success, so it doesn’t hold the pull request back from the queue. In the merge group it runs for real. checks_requested is the only activity type today; listing it keeps the workflow from firing on types GitHub adds later.
The cost is that a pull request looks green on a check that never ran, and an end-to-end failure shows up only after it’s queued. When that happens the queue drops it and rebuilds the groups behind it, so on a busy branch a flaky slow suite costs everyone CI time. If those failures are common, run the slow suite on the pull request too.
Don’t path-filter required workflows
A paths filter is the usual way to save CI time, and it breaks the queue in two ways. The workflow syntax reference only documents paths and paths-ignore for push, pull_request and pull_request_target; for merge_group the event docs only list branches and branches-ignore. And a required workflow skipped by a path, branch or commit message filter leaves its checks Pending, which blocks the merge. Decide inside the workflow instead, with a job-level if, because a job skipped by a conditional reports Success.
Merge queue CI on a third-party provider
There’s no event to subscribe to outside GitHub Actions. The queue pushes temporary branches whose names start with gh-readonly-queue/{base_branch}, and your provider has to build those pushes and report back under the check names your branch rule requires. The docs ask you to trigger and report on merge group events, so a build that passes under a different check name still leaves the queue waiting.
If you’re building a CI integration as a GitHub App, the merge_group webhook needs at least read on the Merge queues permission. Besides checks_requested it sends destroyed, with a reason: the group merged, was dequeued, or was invalidated because an entry ahead of it left the queue, so your integration can cancel builds for groups that will never merge.
The queue settings that touch CI
| Setting | What it does to CI |
|---|---|
| Build concurrency | Caps how many merge_group webhooks dispatch at once, 1 to 100, so it caps parallel queue builds. |
| Status check timeout | How long the queue waits for CI before treating the checks as failed. Set it above your slowest queue run. |
| Only merge non-failing pull requests | Off: a pull request that failed can still merge if the combined group passed, which helps with flaky suites. |
Group sizes and the merge method are covered in the settings table. If GitHub’s queue doesn’t fit your CI (no paths support, private repositories limited to Enterprise Cloud), I compared the merge queue alternatives and their prices.
Review the workflow change too
Most of this ends up as a two-line YAML diff: a merge_group: trigger and an if. It’s exactly the kind of change that gets approved inside a big pull request without anyone noticing it moved the e2e suite out of the pull request. (In Pyor, I group a pull request’s files by file type, so the workflow YAML sits in its own group instead of hiding between app code.)
Frequently asked questions
What is a merge group on GitHub?
It’s what the merge queue builds when you add a pull request: the pull request’s changes on top of the latest base branch and the pull requests queued ahead of it. GitHub fires the merge_group event for it, and the queue waits for your required checks to pass on that combined code before it merges.
Does a merge queue run CI twice?
Yes, for every workflow that listens to both pull_request and merge_group: once on the pull request and once on its merge group. To pay for the slow jobs once, give them if: github.event_name == ‘merge_group’. A job skipped by a conditional reports Success, so it doesn’t block the pull request from entering the queue.
Can I use a paths filter with merge_group?
No. GitHub’s workflow syntax only documents paths and paths-ignore for push, pull_request and pull_request_target, and merge_group only supports branches and branches-ignore. A required workflow skipped by a path filter also stays Pending. Put the condition on the job instead, where a skip reports Success.
How do I make a third-party CI provider work with the GitHub merge queue?
There’s no event to add. Configure the provider to build pushes to branches that start with gh-readonly-queue/ followed by your base branch name, the temporary branches the queue creates, and have it report the same check names your branch rule requires.