| English | 中文 |
Original links:
Teams with high-concurrency PRs encounter a classic problem:
main: A
PR 1: A + B, CI passes
PR 2: A + C, CI passes
Both PRs look fine individually, but after PR 1 is merged, what PR 2 actually merges into is:
A + B + C
This combined result has not been validated, and the main branch could be broken.
The value of Merge Queue is that before actually merging, it constructs a combined result close to what it will be post-merge, and executes required checks on it.
Suitable for:
Not suitable for:
Merge Queue relies on required status checks.
If check items frequently change names, or check items are inconsistent across different PRs, the queue will become very difficult to maintain.
merge_groupGitHub merge queue triggers the merge_group event.
If the team uses GitHub Actions, ensure critical workflows respond to this event:
on:
pull_request:
merge_group:
If using external CI, also confirm that it can recognize the temporary refs or corresponding events created by the merge queue.
Merge Queue will increase merge wait times.
The team needs to define in advance how hotfixes are handled, who can temporarily bypass the queue, and how to backfill validation after bypassing.
Recommended sequence:
merge_group in Actions or external CIMerge Queue makes “pre-merge combination validation” explicit.
If CI is inherently slow, the queue will make this problem more obvious. Test layering and concurrency capabilities must be optimized first.
Unstable tests will cause queue throughput to drop.
Address flaky tests before enabling it, or at least be able to mark, isolate, and re-run them.
Developers need to know:
These rules should be written into the team’s PR guidelines.
Merge Queue is not a “complex feature” only needed by advanced teams.
When the number of PRs grows to a certain point, it solves the fundamental problem of main branch stability.
However, the sequence of enabling it is critical; stable CI and branch protection must come first before discussing merge queues.