Skip to content
Latchkey

How to Skip Duplicate CI Runs

A concurrency group with cancel-in-progress kills the previous run when a newer commit lands, and content-based dedup avoids running the same tree twice.

Two kinds of duplicate work: outdated runs on a branch (solved by concurrency + cancel-in-progress), and the same content built twice across push and PR (solved by a dedup action or careful triggers).

Steps

  • Add a top-level concurrency group keyed on workflow and ref.
  • Set cancel-in-progress: true to drop superseded runs.
  • For content dedup, gate with fkirc/skip-duplicate-actions.

Workflow

.github/workflows/ci.yml
concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true
jobs:
  pre:
    runs-on: ubuntu-latest
    outputs:
      should_skip: ${{ steps.skip.outputs.should_skip }}
    steps:
      - id: skip
        uses: fkirc/skip-duplicate-actions@v5
  build:
    needs: pre
    if: needs.pre.outputs.should_skip != 'true'
    runs-on: ubuntu-latest
    steps: [{ run: npm ci && npm test }]

Gotchas

  • Use cancel-in-progress: false for deploy workflows so a release is never interrupted midway.
  • Cancelling a run marks it cancelled, not success; a required check may need the newer run to complete before merge.

Related guides

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