diff --git a/.github/workflows/ci-build.yml b/.github/workflows/ci-build.yml index c86de1d80..fd5b34876 100644 --- a/.github/workflows/ci-build.yml +++ b/.github/workflows/ci-build.yml @@ -17,6 +17,12 @@ jobs: build: name: Build runs-on: macos-11 + + concurrency: + # When running on develop, use the sha to allow all runs of this workflow to run concurrently. + # Otherwise only allow a single run of this workflow on each branch, automatically cancelling older runs. + group: ${{ github.ref == 'refs/heads/develop' && format('build-develop-{0}', github.sha) || format('build-{0}', github.ref) }} + cancel-in-progress: true steps: - uses: actions/checkout@v2 diff --git a/.github/workflows/ci-tests.yml b/.github/workflows/ci-tests.yml index 65846be15..0fd4f4f61 100644 --- a/.github/workflows/ci-tests.yml +++ b/.github/workflows/ci-tests.yml @@ -17,6 +17,12 @@ jobs: tests: name: Tests runs-on: macos-11 + + concurrency: + # When running on develop, use the sha to allow all runs of this workflow to run concurrently. + # Otherwise only allow a single run of this workflow on each branch, automatically cancelling older runs. + group: ${{ github.ref == 'refs/heads/develop' && format('tests-develop-{0}', github.sha) || format('tests-{0}', github.ref) }} + cancel-in-progress: true steps: - uses: actions/checkout@v2 diff --git a/.github/workflows/release-alpha.yml b/.github/workflows/release-alpha.yml index ed175fe20..887419e26 100644 --- a/.github/workflows/release-alpha.yml +++ b/.github/workflows/release-alpha.yml @@ -16,6 +16,12 @@ jobs: build: name: Release runs-on: macos-11 + + concurrency: + # When running on develop, use the sha to allow all runs of this workflow to run concurrently. + # Otherwise only allow a single run of this workflow on each branch, automatically cancelling older runs. + group: ${{ github.ref == 'refs/heads/develop' && format('alpha-develop-{0}', github.sha) || format('alpha-{0}', github.ref) }} + cancel-in-progress: true steps: - uses: actions/checkout@v2 diff --git a/changelog.d/5039.build b/changelog.d/5039.build new file mode 100644 index 000000000..f791f36fb --- /dev/null +++ b/changelog.d/5039.build @@ -0,0 +1 @@ +Add concurrency to the GitHub workflows to auto-cancel older runs of each action for PRs. \ No newline at end of file