How to Keep the Merge Queue Fast
Queue throughput is bounded by how long the required checks take, so caching, test selection, and batching directly shorten the wait.
Cache dependencies, run only the tests affected by the change, and tune batch size so each merge group builds quickly. Faster required checks mean the queue drains sooner.
Steps
- Cache the dependency store keyed on the lockfile hash.
- Run only tests affected by the change (test impact analysis).
- Right-size the batch so groups build quickly but merge several PRs.
Cache and scope tests
.github/workflows/ci.yml
on:
merge_group:
pull_request:
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
- run: npm ci
- run: npx jest --changedSince=origin/mainGotchas
- Change-based test selection must fall back to the full suite on the merge group to stay safe.
- When runner capacity is the bottleneck, managed runners like Latchkey add parallel capacity and a faster shared cache.
Related guides
How to Tune Merge Queue Batching and Build ConcurrencySet the merge queue group size and build concurrency so the queue batches pull requests efficiently without o…
How to Use the Merge Queue With Matrix BuildsMake a matrix build work as a required check in the GitHub merge queue by adding a summary job so branch prot…
How to Handle a Flaky Required Check Blocking the Merge QueueKeep a flaky required status check from repeatedly kicking pull requests out of the GitHub merge queue by add…