From 6b5130e913612f048a051e9fff20e1d274210d04 Mon Sep 17 00:00:00 2001 From: "Alexander A. Klimov" Date: Fri, 16 Apr 2021 13:10:43 +0200 Subject: [PATCH] GitHub actions: auto-cancel previous jobs for the same PR https://github.com/marketplace/actions/auto-cancellation-running-action --- .github/workflows/docker.yml | 7 +++++++ .github/workflows/packages.yml | 21 +++++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 152b856c2..a4ff677e4 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -15,6 +15,13 @@ 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: docker.yml,packages.yml + access_token: ${{ secrets.GITHUB_TOKEN }} + - name: Docker image uses: Icinga/docker-icinga2@master env: diff --git a/.github/workflows/packages.yml b/.github/workflows/packages.yml index bae0a9ebe..1ee631ec5 100644 --- a/.github/workflows/packages.yml +++ b/.github/workflows/packages.yml @@ -37,6 +37,13 @@ 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: docker.yml,packages.yml + access_token: ${{ secrets.GITHUB_TOKEN }} + - name: Checkout HEAD uses: actions/checkout@v1 @@ -141,6 +148,13 @@ 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: docker.yml,packages.yml + access_token: ${{ secrets.GITHUB_TOKEN }} + - name: Vars id: vars env: @@ -227,6 +241,13 @@ 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: docker.yml,packages.yml + access_token: ${{ secrets.GITHUB_TOKEN }} + - name: Checkout HEAD uses: actions/checkout@v1