Skip to content

Commit 0cca13f

Browse files
authored
workflows/premerge: Cancel in progress jobs when a PR is merged (#125329) (#125588)
(cherry picked from commit 2deba08)
1 parent af7f483 commit 0cca13f

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

.github/workflows/premerge.yaml

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,27 @@ permissions:
55

66
on:
77
pull_request:
8+
types:
9+
- opened
10+
- synchronize
11+
- reopened
12+
# When a PR is closed, we still start this workflow, but then skip
13+
# all the jobs, which makes it effectively a no-op. The reason to
14+
# do this is that it allows us to take advantage of concurrency groups
15+
# to cancel in progress CI jobs whenever the PR is closed.
16+
- closed
17+
paths:
18+
- .github/workflows/premerge.yaml
819
push:
920
branches:
1021
- 'main'
1122
- 'release/**'
1223

1324
jobs:
1425
premerge-checks-linux:
15-
if: false && github.repository_owner == 'llvm'
26+
if: >-
27+
false && github.repository_owner == 'llvm' &&
28+
(github.event_name != 'pull_request' || github.event.action != 'closed')
1629
runs-on: llvm-premerge-linux-runners
1730
concurrency:
1831
group: ${{ github.workflow }}-linux-${{ github.event.pull_request.number || github.sha }}
@@ -71,7 +84,9 @@ jobs:
7184
./.ci/monolithic-linux.sh "$(echo ${linux_projects} | tr ' ' ';')" "$(echo ${linux_check_targets})" "$(echo ${linux_runtimes} | tr ' ' ';')" "$(echo ${linux_runtime_check_targets})"
7285
7386
premerge-checks-windows:
74-
if: false && github.repository_owner == 'llvm'
87+
if: >-
88+
false && github.repository_owner == 'llvm' &&
89+
(github.event_name != 'pull_request' || github.event.action != 'closed')
7590
runs-on: llvm-premerge-windows-runners
7691
concurrency:
7792
group: ${{ github.workflow }}-windows-${{ github.event.pull_request.number || github.sha }}
@@ -139,7 +154,8 @@ jobs:
139154
if: >-
140155
github.repository_owner == 'llvm' &&
141156
(startswith(github.ref_name, 'release/') ||
142-
startswith(github.base_ref, 'release/'))
157+
startswith(github.base_ref, 'release/')) &&
158+
(github.event_name != 'pull_request' || github.event.action != 'closed')
143159
steps:
144160
- name: Checkout LLVM
145161
uses: actions/checkout@v4

0 commit comments

Comments
 (0)