Skip to content
Latchkey

How to Cancel In-Progress Runs in GitHub Actions

A concurrency group with cancel-in-progress kills older runs when a newer one starts.

Set concurrency.group to a key (often per branch) and cancel-in-progress: true. A new run cancels the prior run in the same group.

Steps

  • Add a top-level concurrency: block.
  • Key group on ${{ github.workflow }}-${{ github.ref }}.
  • Set cancel-in-progress: true.

Workflow

.github/workflows/ci.yml
concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - run: npm ci && npm run build

Gotchas

  • For deploys you often want cancel-in-progress: false to avoid interrupting a release.
  • Cancelling frees minutes; Latchkey runners are cheaper still and auto-retry transient failures.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →