From b0da0753d94090128145d03e924f5459ed98f8c4 Mon Sep 17 00:00:00 2001 From: arkon Date: Wed, 10 Aug 2022 22:51:01 -0400 Subject: [PATCH] Use concurrency to cancel duplicate workflow runs Docs: https://docs.github.com/en/actions/using-jobs/using-concurrency --- .github/workflows/build_pull_request.yml | 4 ++++ .github/workflows/build_push.yml | 10 ++++------ .github/workflows/cancel_pull_request.yml | 16 ---------------- 3 files changed, 8 insertions(+), 22 deletions(-) delete mode 100644 .github/workflows/cancel_pull_request.yml diff --git a/.github/workflows/build_pull_request.yml b/.github/workflows/build_pull_request.yml index a52c274d8..ebda14e82 100644 --- a/.github/workflows/build_pull_request.yml +++ b/.github/workflows/build_pull_request.yml @@ -5,6 +5,10 @@ on: - '**.md' - 'app/src/main/res/**/strings.xml' +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number }} + cancel-in-progress: true + permissions: contents: read diff --git a/.github/workflows/build_push.yml b/.github/workflows/build_push.yml index 5d496c284..192116fc8 100644 --- a/.github/workflows/build_push.yml +++ b/.github/workflows/build_push.yml @@ -6,18 +6,16 @@ on: tags: - v* +concurrency: + group: ${{ github.workflow }} + cancel-in-progress: true + jobs: build: name: Build app runs-on: ubuntu-latest steps: - - name: Cancel previous runs - uses: styfle/cancel-workflow-action@0.10.0 - with: - access_token: ${{ github.token }} - all_but_latest: true - - name: Clone repo uses: actions/checkout@v3 diff --git a/.github/workflows/cancel_pull_request.yml b/.github/workflows/cancel_pull_request.yml deleted file mode 100644 index b451d1bda..000000000 --- a/.github/workflows/cancel_pull_request.yml +++ /dev/null @@ -1,16 +0,0 @@ -name: Cancel old pull request workflows - -on: - workflow_run: - workflows: ["PR build check"] - types: - - requested - -jobs: - cancel: - runs-on: ubuntu-latest - steps: - - uses: styfle/cancel-workflow-action@0.10.0 - with: - all_but_latest: true - workflow_id: ${{ github.event.workflow.id }}