about summary refs log tree commit diff
path: root/src/ci
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-06-29 18:18:52 +0000
committerbors <bors@rust-lang.org>2023-06-29 18:18:52 +0000
commitb23a5add09283360bb3b8eaa4292ce3366e62615 (patch)
tree0752d3e146042145822b25b608cf38973b420996 /src/ci
parenta20a04e5d68e85935539c16c945f1947559ad3ce (diff)
parent32428ab5f37b56314715b23b14dd700510d84f1e (diff)
downloadrust-b23a5add09283360bb3b8eaa4292ce3366e62615.tar.gz
rust-b23a5add09283360bb3b8eaa4292ce3366e62615.zip
Auto merge of #113059 - Kobzol:ci-concurrency-fix, r=pietroalbini
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: https://github.com/rust-lang/rust/pull/112955#discussion_r1242273658

r? `@pietroalbini`
Diffstat (limited to 'src/ci')
-rw-r--r--src/ci/github-actions/ci.yml7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/ci/github-actions/ci.yml b/src/ci/github-actions/ci.yml
index 8907d643182..cb12042c117 100644
--- a/src/ci/github-actions/ci.yml
+++ b/src/ci/github-actions/ci.yml
@@ -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: