Skip to content

Commit

Permalink
Auto merge of #113059 - Kobzol:ci-concurrency-fix, r=pietroalbini
Browse files Browse the repository at this point in the history
CI: do not cancel concurrent builds on the same branch

Do not cancel concurrent builds on the same branch (outside of PRs).

Instead, only cancel them if the builds have the same commit SHA.

From the [documentation](https://docs.github.com/en/actions/learn-github-actions/contexts#github-context):
> The commit SHA that triggered the workflow. The value of this commit SHA depends on the event that triggered the workflow. For more information, see "[Events that trigger workflows](https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows)." For example, ffac537e6cbbf934b08745a378932722df287a53.

Fixes: #112955 (comment)

r? `@pietroalbini`
  • Loading branch information
bors committed Jun 29, 2023
2 parents a20a04e + 32428ab commit b23a5ad
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ defaults:
run:
shell: bash
concurrency:
group: "${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}"
group: "${{ ((github.ref == 'refs/heads/try' || github.ref == 'refs/heads/try-perf') && github.sha) || github.ref }}"
cancel-in-progress: true
jobs:
pr:
Expand Down
7 changes: 4 additions & 3 deletions src/ci/github-actions/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -299,9 +299,10 @@ defaults:
shell: bash

concurrency:
# For a given workflow, if we push to the same PR, cancel all previous builds on that PR.
# If the push is not attached to a PR, we will cancel all builds related to the same commit SHA.
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
# For a given workflow, if we push to the same branch, cancel all previous builds on that branch.
# We add an exception for try builds (try branch) and unrolled rollup builds (try-perf), which
# are all triggered on the same branch, but which should be able to run concurrently.
group: ${{ ((github.ref == 'refs/heads/try' || github.ref == 'refs/heads/try-perf') && github.sha) || github.ref }}
cancel-in-progress: true

jobs:
Expand Down

0 comments on commit b23a5ad

Please sign in to comment.