Stop wasting minutes on stale commits
If you push 10 times in 5 minutes, the default behavior is 10 parallel runs of CI. Nine of them are obsolete the moment they start. concurrency: declares a group; only one run per group can be active at a time, and you choose what happens when a new run starts in an active group.
Two settings
group:— a string template that identifies the group. Common:${{ github.workflow }}-${{ github.ref }}(one run per workflow per branch).cancel-in-progress:— true cancels the running one to start the new; false queues the new one.
Pick the right group
- PR feedback — group on
github.ref; cancel-in-progress true. New push obsoletes old run. - Deploy — group on environment name; cancel-in-progress false. Two deploys to the same env serialize.
- Release — group on
github.workflow; cancel-in-progress false. Releases queue, never overlap.