From 6efd01f707bc68fd1f210bbe0cd33624745b961c Mon Sep 17 00:00:00 2001 From: Tejas Chopra Date: Mon, 13 Jul 2026 13:47:59 -0400 Subject: [PATCH] ci: concurrency-cancel Docker + Merge Conflicts to stop merge-spree pileups (#2138) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Description `docker.yml` builds a full multi-arch image on **every push to `main`** with **no concurrency group**, so a merge spree stacks one build per commit. Against the Free-plan **20 concurrent-job cap**, those long builds hog the runner pool and starve the `CI` (`test`/`lint`/`build`) jobs that PR merges actually depend on. This adds concurrency-cancel so only the latest build per ref runs — `cancel-in-progress` scoped to `main` so a release tag's publish (its own ref) is never killed. Same fix for the per-PR **Merge Conflicts** check. ## Type of Change - [x] Repo infrastructure / CI (no functional change) ## Changes Made - `.github/workflows/docker.yml`: `concurrency: docker-${{ github.ref }}`, cancel-in-progress on `main` only. - `.github/workflows/merge-conflicts.yml`: per-PR concurrency-cancel. ## Testing - [x] YAML validated (`yaml.safe_load` on both) — release/tag builds unaffected (separate ref group). ## Real Behavior Proof - Before: 24 merges → 24 stacked Docker builds queued against 20 slots. - After: only the latest `main` Docker build runs; older superseded ones auto-cancel; release publishes untouched. --- .github/workflows/docker.yml | 8 ++++++++ .github/workflows/merge-conflicts.yml | 4 ++++ 2 files changed, 12 insertions(+) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 790465e03..accab994a 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -22,6 +22,14 @@ on: release: types: [published] +# A merge spree pushes many commits to main; without this, each commit starts +# a full multi-arch image build and they pile up against the 20-job concurrency +# cap. Supersede all but the latest build for a given ref. cancel-in-progress is +# scoped to main only so a release tag's publish (its own ref) is never killed. +concurrency: + group: docker-${{ github.ref }} + cancel-in-progress: ${{ github.ref == 'refs/heads/main' }} + env: REGISTRY: ghcr.io diff --git a/.github/workflows/merge-conflicts.yml b/.github/workflows/merge-conflicts.yml index a6fa06400..3b88bf55b 100644 --- a/.github/workflows/merge-conflicts.yml +++ b/.github/workflows/merge-conflicts.yml @@ -12,6 +12,10 @@ on: pull_request: branches: [main] +concurrency: + group: merge-conflicts-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + permissions: contents: read