From b02af914208414a4a181192c376c13474a60a9f5 Mon Sep 17 00:00:00 2001 From: "Alexander A. Klimov" Date: Thu, 19 Jan 2023 10:47:14 +0100 Subject: [PATCH] GHA: let GitHub cancel redundant jobs This will also cancel not yet finished master builds, but that's not too bad. --- .github/workflows/deb.yml | 11 ++++------- .github/workflows/docker.yml | 11 ++++------- .github/workflows/raspbian.yml | 11 ++++------- .github/workflows/rpm.yml | 11 ++++------- .github/workflows/windows.yml | 4 ++++ 5 files changed, 20 insertions(+), 28 deletions(-) diff --git a/.github/workflows/deb.yml b/.github/workflows/deb.yml index f77bc3595..cf911fbf3 100644 --- a/.github/workflows/deb.yml +++ b/.github/workflows/deb.yml @@ -7,6 +7,10 @@ on: - 'support/*' pull_request: {} +concurrency: + group: deb-${{ github.ref }} + cancel-in-progress: true + jobs: deb: name: .deb @@ -31,13 +35,6 @@ jobs: runs-on: ubuntu-latest steps: - - name: Cancel previous jobs for the same PR - if: "github.event_name == 'pull_request'" - uses: styfle/cancel-workflow-action@89f242ee29e10c53a841bfe71cc0ce7b2f065abc - with: - workflow_id: deb.yml,docker.yml,raspbian.yml,rpm.yml,windows.yml - access_token: ${{ secrets.GITHUB_TOKEN }} - - name: Checkout HEAD uses: actions/checkout@v1 diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 1e59e7329..d4883b5d0 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -10,6 +10,10 @@ on: types: - published +concurrency: + group: docker-${{ github.ref }} + cancel-in-progress: true + jobs: docker-release: if: github.event_name == 'release' @@ -27,13 +31,6 @@ jobs: runs-on: ubuntu-latest steps: - - name: Cancel previous jobs for the same PR - if: "github.event_name == 'pull_request'" - uses: styfle/cancel-workflow-action@89f242ee29e10c53a841bfe71cc0ce7b2f065abc - with: - workflow_id: deb.yml,docker.yml,raspbian.yml,rpm.yml,windows.yml - access_token: ${{ secrets.GITHUB_TOKEN }} - - name: Docker image uses: Icinga/docker-icinga2@master with: diff --git a/.github/workflows/raspbian.yml b/.github/workflows/raspbian.yml index 9bcca7c6d..cd926b9df 100644 --- a/.github/workflows/raspbian.yml +++ b/.github/workflows/raspbian.yml @@ -7,6 +7,10 @@ on: - 'support/*' pull_request: {} +concurrency: + group: raspbian-${{ github.ref }} + cancel-in-progress: true + jobs: raspbian: name: Raspbian @@ -20,13 +24,6 @@ jobs: runs-on: ubuntu-22.04 # revert back to ubuntu-latest once that is 22.04 or later steps: - - name: Cancel previous jobs for the same PR - if: "github.event_name == 'pull_request'" - uses: styfle/cancel-workflow-action@89f242ee29e10c53a841bfe71cc0ce7b2f065abc - with: - workflow_id: deb.yml,docker.yml,raspbian.yml,rpm.yml,windows.yml - access_token: ${{ secrets.GITHUB_TOKEN }} - - name: Checkout HEAD uses: actions/checkout@v1 diff --git a/.github/workflows/rpm.yml b/.github/workflows/rpm.yml index 564d8240c..e35205500 100644 --- a/.github/workflows/rpm.yml +++ b/.github/workflows/rpm.yml @@ -7,6 +7,10 @@ on: - 'support/*' pull_request: {} +concurrency: + group: rpm-${{ github.ref }} + cancel-in-progress: true + jobs: rpm: name: .rpm (${{ matrix.distro.name }}, ${{ matrix.distro.release }}) @@ -43,13 +47,6 @@ jobs: runs-on: ubuntu-latest steps: - - name: Cancel previous jobs for the same PR - if: "github.event_name == 'pull_request'" - uses: styfle/cancel-workflow-action@89f242ee29e10c53a841bfe71cc0ce7b2f065abc - with: - workflow_id: deb.yml,docker.yml,raspbian.yml,rpm.yml,windows.yml - access_token: ${{ secrets.GITHUB_TOKEN }} - - name: Vars id: vars env: diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index a8417a5f3..8f7c7a292 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -7,6 +7,10 @@ on: - 'support/*' pull_request: {} +concurrency: + group: windows-${{ github.ref }} + cancel-in-progress: true + jobs: windows: name: Windows