Skip to content

CICD-024 · Prioritize new checks on a branch ​

Encyclopedia · Jobs, steps and runner selection · All snippets

Previous · CICD-023 · Next · CICD-025

1. Where it fits ​

  • Placement .github/workflows/ci.yml, inside the relevant job.
  • Prerequisites workflow containing the named example jobs or steps.
  • Platforms github-actions, gitea-actions.

2. Copy the snippet ​

yaml
concurrency:
  group: "verify-${{ github.workflow }}-${{ github.ref }}"
  cancel-in-progress: true

3. How it works ​

The group combines the workflow identity and branch ref. A newer run in that group can cancel an older one when cancel-in-progress is true.

The concurrency key defines which existing run a new push can supersede.

flowchart TD
  N1["New push"]
  N2{"Same group as running job"}
  N1 --> N2
  N3["Cancel older run"]
  N2 -->|Yes| N3
  N4["Keep older group's run"]
  N2 -->|No| N4
  N5["Queue new run"]
  N3 --> N5
  N4 --> N5

4. Verify the result ​

Verify a new push cancels a running obsolete PR check. Scope group names to avoid collisions.

Validation syntax-validated (YAML parse). Status definitions.