From db38aaf54cef24fed9a1cd8c65dbbcc60e36c5c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kevin=20Gr=C3=BCneberg?= Date: Sat, 27 Sep 2025 16:29:43 +0800 Subject: [PATCH] build: automatically cancel old tests/build on new push Currently, whenever you push any commit to your branch, the old builds are still running and a new build is started. Once a new commit is added, the old test results no longer matter and it's just a waste of CI resources. Also reduces confusion with multiple builds running in parallel for the same branch/possibly blocking any merges. With this little change, we ensure that whenever a new commit is added, the previous build is immediately canceled/stopped and only the build (latest commit) runs. --- .github/workflows/check-shellscripts.yml | 4 ++++ .github/workflows/ci.yml | 4 ++++ .github/workflows/nix-build.yml | 4 ++++ 3 files changed, 12 insertions(+) diff --git a/.github/workflows/check-shellscripts.yml b/.github/workflows/check-shellscripts.yml index aabf17413..9d1389e9e 100644 --- a/.github/workflows/check-shellscripts.yml +++ b/.github/workflows/check-shellscripts.yml @@ -7,6 +7,10 @@ on: pull_request: workflow_dispatch: +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: ${{ github.event_name == 'pull_request' }} + permissions: contents: read diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f10f5f58e..12abc8e91 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,6 +6,10 @@ on: permissions: contents: read +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + jobs: check-release-version: timeout-minutes: 5 diff --git a/.github/workflows/nix-build.yml b/.github/workflows/nix-build.yml index c2f383961..695dc2abf 100644 --- a/.github/workflows/nix-build.yml +++ b/.github/workflows/nix-build.yml @@ -14,6 +14,10 @@ permissions: contents: write packages: write +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: ${{ github.event_name == 'pull_request' }} + jobs: build-run-image: strategy: