Skip to content

Commit 2deba08

Browse files
authored
workflows/premerge: Cancel in progress jobs when a PR is merged (#125329)
1 parent d156b85 commit 2deba08

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

.github/workflows/premerge.yaml

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,15 @@ 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
817
paths:
918
- .github/workflows/premerge.yaml
1019
push:
@@ -14,7 +23,9 @@ on:
1423

1524
jobs:
1625
premerge-checks-linux:
17-
if: github.repository_owner == 'llvm'
26+
if: >-
27+
github.repository_owner == 'llvm' &&
28+
(github.event_name != 'pull_request' || github.event.action != 'closed')
1829
runs-on: llvm-premerge-linux-runners
1930
concurrency:
2031
group: ${{ github.workflow }}-linux-${{ github.event.pull_request.number || github.sha }}
@@ -73,7 +84,9 @@ jobs:
7384
./.ci/monolithic-linux.sh "$(echo ${linux_projects} | tr ' ' ';')" "$(echo ${linux_check_targets})" "$(echo ${linux_runtimes} | tr ' ' ';')" "$(echo ${linux_runtime_check_targets})"
7485
7586
premerge-checks-windows:
76-
if: github.repository_owner == 'llvm'
87+
if: >-
88+
github.repository_owner == 'llvm' &&
89+
(github.event_name != 'pull_request' || github.event.action != 'closed')
7790
runs-on: llvm-premerge-windows-runners
7891
concurrency:
7992
group: ${{ github.workflow }}-windows-${{ github.event.pull_request.number || github.sha }}
@@ -141,7 +154,8 @@ jobs:
141154
if: >-
142155
github.repository_owner == 'llvm' &&
143156
(startswith(github.ref_name, 'release/') ||
144-
startswith(github.base_ref, 'release/'))
157+
startswith(github.base_ref, 'release/')) &&
158+
(github.event_name != 'pull_request' || github.event.action != 'closed')
145159
steps:
146160
- name: Checkout LLVM
147161
uses: actions/checkout@v4

0 commit comments

Comments
 (0)