Prev Next

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.

flowchart LR A[PR-1 added to queue] --> B[Tested against: main + PR-1] C[PR-2 added to queue] --> D[Tested against: main + PR-1 + PR-2] B --> E{Checks pass?} D --> F{Checks pass?} E -->|Yes| G[PR-1 merged into real main] F -->|Yes| H[PR-2 merged into real main] E -->|No| I[PR-1 removed from queue] F -->|No| J[PR-2 removed from queue]

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.

The core problem the merge queue solves is:
When a PR in the middle of the merge queue fails its checks:

More Related questions...

What is GitHub? What is a GitHub repository? What is the difference between Git and GitHub? What is the difference between GitHub and GitLab? What are the main features of GitHub? What is a GitHub pull request? What is GitHub Actions? What is a GitHub Actions workflow file? What is a GitHub Actions runner? What are jobs and steps in a GitHub Actions workflow? What is GitHub Issues? What are GitHub Projects (boards)? What is a GitHub organization? What is GitHub Packages? What is GitHub Pages? What are branch protection rules in GitHub? What is GitHub Copilot? What is forking in GitHub? What are GitHub labels? What is the GitHub Wiki? What are the different GitHub plans? What is a GitHub Gist? What is GitHub Codespaces? What is a GitHub template repository? What are GitHub releases and tags? Explain the execution flow of a GitHub Actions workflow from push to deployment? Why would a team choose GitHub over GitLab for an open-source project? How does a GitHub pull request differ from a GitLab merge request? What is the difference between GitHub.com and GitHub Enterprise Server? How do you write a multi-job GitHub Actions workflow? When should you use repository secrets versus environment secrets in GitHub Actions? How do you troubleshoot a GitHub Actions job stuck queued? What is the difference between GitHub-hosted runners and self-hosted runners? How does GitHub enforce required reviewers with CODEOWNERS? Explain the internal working of GitHub Actions' merge queue? What is the difference between GitHub Actions and Jenkins? How do you implement GitOps with GitHub Actions and Kubernetes? Why use GitHub's Dependabot instead of manually tracking dependency updates? What is the difference between "uses" and "run" in a GitHub Actions step? How does GitHub Actions cache dependencies between workflow runs? When would you choose GitHub Enterprise Cloud over GitHub Team? How do you configure branch protection to enforce a pull-request-only workflow? What is the difference between GitHub Actions "on: pull_request" and "on: push" triggers? Explain the lifecycle of a GitHub issue from creation to closure? How do you optimize GitHub Actions workflow performance for a large monorepo? What is the difference between GitHub Packages and Docker Hub? How does GitHub Actions decide which workflow to trigger for a given event? Why should you use GitHub Environments to track deployments? What is the difference between repository-level and organization-level GitHub Actions secrets? How do you troubleshoot merge conflicts flagged in a GitHub pull request?
Show more question and Answers...


Comments & Discussions