DevOpsInterviewPrep logo
← 🚀 Delivery & GitOps
Foundational

GitHub Actions concurrency and deployment order: serialize the target without losing intent

Reason about GitHub Actions concurrency groups, pending replacement and environment approvals. Preserve deployment intent and reconcile external effects after cancellation.

TL;DR: A concurrency group limits simultaneous work sharing that group within a repository. Choose a key representing the target resource and review cancellation separately. An approved environment does not automatically serialize deployments, and canceling a runner does not roll back an external operation.

Group by the resource that must have one writer

Suppose release.yml and hotfix.yml both update the same production service. A group containing github.workflow gives the two workflows different keys. Each can obey its own concurrency limit while their deployments overlap. Use the same target-specific key when both must share one writer, and keep independent services in different groups.

The group is repository-scoped. A similarly named group in another repository does not form a distributed deployment lock. Cross-repository writers require a shared coordination mechanism at the delivery system or target.

rendering diagram…

Choose what happens to waiting work

In the default single-pending mode, an active run can continue while a newer pending run replaces an older pending run. cancel-in-progress: false protects the active run from this cancellation policy; it does not preserve every pending candidate.

The concurrency reference, reviewed 24 November 2026, also documents queue: max for a larger bounded pending queue. It cannot be combined with cancel-in-progress: true. Check availability on the target GitHub product/version before relying on it. Queue arrival order should not be confused with source commit order: workflows can reach the concurrency boundary at different times.

RequirementSuitable decisionEvidence still needed
Keep only newest waiting previewDefault pending replacement may fitOld preview cannot publish after replacement
Preserve each migration intentReviewed queue or external sequencerEvery operation recorded and ordered correctly
Avoid canceling active deploymentDisable active cancellationExternal operation completes or is reconciled
Serialize two release workflowsSame target group within repositoryBoth paths actually use the group

Work through three candidates

Assume default single-pending behavior. Candidate A is applying, B waits, then C arrives. With active cancellation disabled, A remains active, C replaces B as the pending candidate and B is canceled. That can be correct for stateless previews. It is unsafe if B contains a one-time operation that C assumes already happened.

For application releases, make each candidate deploy a declared desired state and verify compatibility with the currently deployed version. For sequential data migrations, preserve an explicit operation ledger and ordering requirement. A concurrency key is not that ledger.

Approval and mutual exclusion answer different questions

A protected environment can require review before a deployment job proceeds. Concurrency controls overlapping execution. Review both, including which immutable candidate the approval references. GitHub's deployment guide describes environments and concurrency as separate controls.

If a workflow is canceled after submitting a cloud deployment, query the target operation ID and actual state before another writer starts. The remote deployment may continue after the runner stops. Build cancellation, deployment rollback and rollback verification are separate events.

Self-check: both release and hotfix reference environment production, but their concurrency groups include different workflow names. Are deployments serialized together? No. They need a shared group for that target, or an external coordinator covering every writer.

Rehearse the missing pending deployment with an explicit candidate timeline.

RELATED CONCEPTS
PRACTICE THIS IN REAL QUESTIONS