CI/CD · GitHub Actions
GitHub Actions Concurrency: Cancel Stale CI Without Interrupting Deployments
Choose concurrency groups that reduce redundant tests while respecting deployment boundaries.

Pushing several commits quickly can leave CI testing revisions that nobody intends to merge. GitHub Actions concurrency groups help control this overlap.
Group CI by workflow and branch
At workflow level, set concurrency.group to ${{ github.workflow }}-${{ github.ref }} and cancel-in-progress to true. Runs sharing that group cannot execute simultaneously, and a newer run can cancel the active one. Different branches remain independent.
Choose the cancellation boundary
Including the workflow name avoids unintended collisions between separate workflows. For pull requests, inspect the event context before choosing a group expression; branch and pull-request refs are not interchangeable identities.
Treat deployment jobs separately
Canceling a test run usually wastes only partial work. Canceling a deployment may interrupt a migration or release sequence. Give deployment jobs an environment-specific group and decide explicitly whether cancellation is acceptable. Concurrency does not undo completed external operations.
Understand pending runs
With the default queue behavior, a newer pending run replaces the existing pending run in the same group. Disabling active-run cancellation alone therefore does not guarantee every queued deployment executes.
Review cancellation logs and verify the latest commit passed before merging.