Which configuration cancels any in-progress workflow run for the same branch when a new push triggers a new run?
Select an answer to reveal the explanation.
Short Explanation and Infographic
Using github.ref as the concurrency group key groups all runs on the same branch together, letting cancel-in-progress boot the old one when a new push arrives.
Full explanation below image
Full Explanation
The 'concurrency' block at the workflow or job level controls simultaneous runs. The 'group:' key defines what counts as 'concurrent' — using 'github.ref' groups runs by branch/tag, so two pushes to 'main' are in the same group. 'cancel-in-progress: true' cancels the currently running workflow when a new one enters the same group. Using 'github.sha' would create a unique group per commit (no cancellation ever). 'strategy.cancel-duplicates' and 'on.push.cancel-previous' are not valid GitHub Actions syntax.