From 4b5fbf70f2fe37d72152385276a30e95087d62fb Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Tue, 24 Sep 2024 09:02:01 -0700 Subject: [PATCH] CI: cancel workflows when PRs are updated (#16562) For checkstyle, zloop, zfs-qemu, and codeql workflows cancel in-progress jobs when the PR is updated. Relevant GitHub Actions documentation: The following concurrency group cancels in-progress jobs or run on pull_request events only; if github.head_ref is undefined, the concurrency group will fallback to the run ID, which is guaranteed to be both unique and defined for the run. https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions#example-using-a-fallback-value Signed-off-by: Brian Behlendorf Closes #16562 --- .github/workflows/checkstyle.yaml | 4 ++++ .github/workflows/codeql.yml | 4 ++++ .github/workflows/zfs-qemu.yml | 5 ++++- .github/workflows/zloop.yml | 4 ++++ 4 files changed, 16 insertions(+), 1 deletion(-) diff --git a/.github/workflows/checkstyle.yaml b/.github/workflows/checkstyle.yaml index 088d28d52a90..b34ca1302873 100644 --- a/.github/workflows/checkstyle.yaml +++ b/.github/workflows/checkstyle.yaml @@ -4,6 +4,10 @@ on: push: pull_request: +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + jobs: checkstyle: runs-on: ubuntu-22.04 diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index f70f6bf86ea8..2656a20fea0d 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -4,6 +4,10 @@ on: push: pull_request: +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + jobs: analyze: name: Analyze diff --git a/.github/workflows/zfs-qemu.yml b/.github/workflows/zfs-qemu.yml index 18004c489479..67d915adfef5 100644 --- a/.github/workflows/zfs-qemu.yml +++ b/.github/workflows/zfs-qemu.yml @@ -4,8 +4,11 @@ on: push: pull_request: -jobs: +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true +jobs: qemu-vm: name: qemu-x86 strategy: diff --git a/.github/workflows/zloop.yml b/.github/workflows/zloop.yml index bf0762ff9ac3..35d8cc977af0 100644 --- a/.github/workflows/zloop.yml +++ b/.github/workflows/zloop.yml @@ -4,6 +4,10 @@ on: push: pull_request: +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + jobs: zloop: runs-on: ubuntu-24.04