With 150 PRs a day, main keeps breaking because PRs that pass alone fail together. How do you fix it?
IntermediateScenarioPipelines at scale
Answer
Situation read → Each PR was tested against an old version of main. Two green PRs can conflict logically. A merge queue tests them in the order they'll land.
What I'd do →
- Enable GitHub merge queue (or GitLab merge trains) on main.
- Make CI run on the
merge_groupevent too:
on:
pull_request:
merge_group:
- The queue builds main + PR1, main + PR1 + PR2, and so on; a failing entry is removed and the rest re-tested.
- Keep the queued check fast (unit and key integration tests) so throughput stays high; run long suites post-merge.
- Turn off "require branches to be up to date" once the queue is on; the queue does that job.
Why → Testing the exact combination that will land is the only way to keep main green at high volume.
Interview tip → Mention the merge_group trigger; missing it is the usual reason the queue gets stuck.
More on Pipelines at scale
The CI pipeline takes 45 minutes. Developers want it under 10. How do you approach it?IntermediateYou have a monorepo with 40 services. Every commit builds and tests all of them. How do you fix that?AdvancedFlaky tests fail 1 in 5 runs and developers just click "re-run". How do you fix this culture and the tests?BeginnerYour self-hosted GitHub runners can't keep up at peak and sit idle at night. How do you run them at scale?AdvancedDocker builds in CI take 12 minutes because every runner starts with an empty cache. How do you speed them up?IntermediateHow do you secure the software supply chain from commit to production?Advanced