From a0104797f97309a9b1d84870dccb0b2772aa6dda Mon Sep 17 00:00:00 2001 From: Manuel Raynaud Date: Wed, 30 Sep 2026 14:30:55 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=91=B7(ci)=20cancel=20the=20superseded=20?= =?UTF-8?q?runs=20of=20a=20pull=20request?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit adding a concurrency group will now stop running CI if a new push is made on the same branch. --- .github/workflows/crowdin_download.yml | 5 +++++ .github/workflows/crowdin_upload.yml | 5 +++++ .github/workflows/docker-hub.yml | 8 ++++++++ .github/workflows/ghcr.yml | 8 ++++++++ .github/workflows/helmfile-linter.yaml | 7 +++++++ .github/workflows/impress-frontend.yml | 7 +++++++ .github/workflows/impress.yml | 7 +++++++ .github/workflows/label_preview.yml | 4 ++++ .github/workflows/loadtest.yml | 7 +++++++ .github/workflows/yhub.yml | 7 +++++++ CHANGELOG.md | 1 + 11 files changed, 66 insertions(+) diff --git a/.github/workflows/crowdin_download.yml b/.github/workflows/crowdin_download.yml index 3f875ca45..1483686b3 100644 --- a/.github/workflows/crowdin_download.yml +++ b/.github/workflows/crowdin_download.yml @@ -9,6 +9,11 @@ on: permissions: contents: read +# Only the latest commit matters: a newer push cancels the run in progress. +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + jobs: install-dependencies: uses: ./.github/workflows/dependencies.yml diff --git a/.github/workflows/crowdin_upload.yml b/.github/workflows/crowdin_upload.yml index a334ddce4..2615c3a7c 100644 --- a/.github/workflows/crowdin_upload.yml +++ b/.github/workflows/crowdin_upload.yml @@ -9,6 +9,11 @@ on: permissions: contents: read +# Only the latest commit matters: a newer push cancels the run in progress. +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + jobs: install-dependencies: uses: ./.github/workflows/dependencies.yml diff --git a/.github/workflows/docker-hub.yml b/.github/workflows/docker-hub.yml index 984b738a1..4757722c9 100644 --- a/.github/workflows/docker-hub.yml +++ b/.github/workflows/docker-hub.yml @@ -19,6 +19,14 @@ env: permissions: contents: read +# One run per pull request, cancelled by a newer push. On a branch or a tag +# the runs are queued instead of cancelled: an image push or the Argo CD +# notification is never stopped halfway, and two runs never race to push the +# same tag (only the latest pending run is kept). +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: ${{ github.event_name == 'pull_request' }} + jobs: build-and-push-backend: uses: ./.github/workflows/docker-publish.yml diff --git a/.github/workflows/ghcr.yml b/.github/workflows/ghcr.yml index 00040dd63..df9d87b8d 100644 --- a/.github/workflows/ghcr.yml +++ b/.github/workflows/ghcr.yml @@ -16,6 +16,14 @@ env: permissions: contents: read +# One run per pull request, cancelled by a newer push. On a branch or a tag +# the runs are queued instead of cancelled: an image push or the Argo CD +# notification is never stopped halfway, and two runs never race to push the +# same tag (only the latest pending run is kept). +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: ${{ github.event_name == 'pull_request' }} + jobs: build-and-push-backend: runs-on: ubuntu-latest diff --git a/.github/workflows/helmfile-linter.yaml b/.github/workflows/helmfile-linter.yaml index 793425e71..19a226792 100644 --- a/.github/workflows/helmfile-linter.yaml +++ b/.github/workflows/helmfile-linter.yaml @@ -7,6 +7,13 @@ on: branches: - 'main' +# One run per pull request: a new push cancels the checks of the previous one. +# Pushes get a group of their own (the commit), so every commit of main keeps +# its full set of checks. +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }} + cancel-in-progress: true + jobs: helmfile-lint: runs-on: ubuntu-latest diff --git a/.github/workflows/impress-frontend.yml b/.github/workflows/impress-frontend.yml index 6eaa55c25..f9e515dd6 100644 --- a/.github/workflows/impress-frontend.yml +++ b/.github/workflows/impress-frontend.yml @@ -11,6 +11,13 @@ on: permissions: contents: read +# One run per pull request: a new push cancels the checks of the previous one. +# Pushes get a group of their own (the commit), so every commit of main keeps +# its full set of checks. +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }} + cancel-in-progress: true + jobs: install-dependencies: diff --git a/.github/workflows/impress.yml b/.github/workflows/impress.yml index 6dec4482e..ca7ba4f87 100644 --- a/.github/workflows/impress.yml +++ b/.github/workflows/impress.yml @@ -11,6 +11,13 @@ on: permissions: contents: read +# One run per pull request: a new push cancels the checks of the previous one. +# Pushes get a group of their own (the commit), so every commit of main keeps +# its full set of checks. +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }} + cancel-in-progress: true + jobs: install-dependencies: uses: ./.github/workflows/dependencies.yml diff --git a/.github/workflows/label_preview.yml b/.github/workflows/label_preview.yml index 73295475a..e78077932 100644 --- a/.github/workflows/label_preview.yml +++ b/.github/workflows/label_preview.yml @@ -7,6 +7,10 @@ on: permissions: pull-requests: write +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number }} + cancel-in-progress: true + jobs: comment: runs-on: ubuntu-latest diff --git a/.github/workflows/loadtest.yml b/.github/workflows/loadtest.yml index cb2cf3b34..f08ed8110 100644 --- a/.github/workflows/loadtest.yml +++ b/.github/workflows/loadtest.yml @@ -15,6 +15,13 @@ permissions: # swarm and canary are standalone TypeScript packages, each with its own # package.json and yarn.lock, like src/yhub-server; k6 runs plain scripts and # the dashboards are generated by a python script. +# One run per pull request: a new push cancels the checks of the previous one. +# Pushes get a group of their own (the commit), so every commit of main keeps +# its full set of checks. +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }} + cancel-in-progress: true + jobs: lint-and-test-loadtest: runs-on: ubuntu-latest diff --git a/.github/workflows/yhub.yml b/.github/workflows/yhub.yml index 5be422a5c..2cffc7d60 100644 --- a/.github/workflows/yhub.yml +++ b/.github/workflows/yhub.yml @@ -19,6 +19,13 @@ defaults: run: working-directory: src/yhub-server +# One run per pull request: a new push cancels the checks of the previous one. +# Pushes get a group of their own (the commit), so every commit of main keeps +# its full set of checks. +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }} + cancel-in-progress: true + jobs: lint-yhub: runs-on: ubuntu-latest diff --git a/CHANGELOG.md b/CHANGELOG.md index f624f0b4d..3b5ecce39 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ and this project adheres to - 👷(ci) lint, typecheck, build and test the collaboration server (yhub) - 👷(ci) check the load-test tooling: swarm, canary, k6 and dashboards +- 👷(ci) cancel the superseded runs of a pull request - ✨(backend) add mention endpoint with cooldown-limited email notification #2447 - 🚩(setting) add feature flag on Duplicate with Children #2721