concurrency group
A workflow setting that lets only one run with the same group name proceed at a time, optionally cancelling the older run.
In more detail
Two quick pushes can start two deploys that race, and the older one may finish last and undo the newer one. A group built from github.ref with cancel-in-progress: true makes the newest push win and keeps different branches from queueing behind each other.
Example
concurrency:
group: deploy-${{ github.ref }}
cancel-in-progress: trueRelated terms
- race condition — A bug whose outcome depends on the timing of two things happening at once.
- github context — The expression object that describes the current run: its event, commit SHA, ref, actor, repository and more.
Taught in
- Triggers and the Event Model — Continuous Integration & Continuous Delivery Pipelines
- Matrices, Needs And Concurrency: The Shape Of A Run — GitHub Actions (GH-200) Exam Prep
- Environments: Reviewers, Wait Timers And Deployment Rules — GitHub Actions (GH-200) Exam Prep
- Faster And Cheaper: Where The Minutes Go — GitHub Actions (GH-200) Exam Prep
- YAML-Reading Sprint: What Happens When This Runs? — GitHub Actions (GH-200) Exam Prep