DevOps / Github Interview questions
Explain the internal working of GitHub Actions' merge queue?
The merge queue exists to solve a specific problem: when several pull requests are approved around the same time and merged one after another, each was only tested against the target branch as it existed before the others merged. Two individually-passing PRs can still break the target branch once combined.
Instead of merging each PR straight into the current main, GitHub builds a temporary combined branch for each position in the queue: the first PR is tested against main, the second is tested against main plus the first PR's changes, and so on. A PR only merges into the real target branch once its position's combined checks pass.
If a PR partway through the queue fails its checks, it's dropped from the queue, and everything behind it is automatically re-tested against the corrected sequence rather than merging on top of a change that never actually landed. This keeps the target branch reliably green even under a high rate of concurrent merges, which simple sequential merging doesn't guarantee.
More Related questions...