From a1dbe73e921ab542cacc45791f465422a5dc60ee Mon Sep 17 00:00:00 2001 From: Derek Date: Fri, 15 Jul 2022 09:32:13 +0200 Subject: [PATCH] feat: uses concurrency to cancel obsolete runs --- .github/workflows/swift.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/workflows/swift.yml b/.github/workflows/swift.yml index 7dc66c564..32ac88a03 100644 --- a/.github/workflows/swift.yml +++ b/.github/workflows/swift.yml @@ -6,6 +6,15 @@ on: pull_request: branches: [ main, develop ] +concurrency: + # Support push/pr as event types with different behaviors each: + # 1. push: queue up builds by branch + # 2. pr: only allow one run per PR + group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.event.pull_request.number || github.ref_name }} + # If there is already a workflow running for the same pull request, cancel it + # For non-PR triggers queue up builds + cancel-in-progress: ${{ github.event_name == 'pull_request' }} + jobs: build: runs-on: macos-latest