[llvm-branch-commits] [llvm] workflows/premerge: Cancel in progress jobs when a PR is merged (#125329) (PR #125588)
Tom Stellard via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Mon Feb 3 13:45:21 PST 2025
https://github.com/tstellar created https://github.com/llvm/llvm-project/pull/125588
(cherry picked from commit 2deba08e09b9412c9f4e5888237e28173dee085b)
>From 34bae71660d86455c5a51ad00fec49129847bc1d Mon Sep 17 00:00:00 2001
From: Tom Stellard <tstellar at redhat.com>
Date: Mon, 3 Feb 2025 13:20:37 -0800
Subject: [PATCH] workflows/premerge: Cancel in progress jobs when a PR is
merged (#125329)
(cherry picked from commit 2deba08e09b9412c9f4e5888237e28173dee085b)
---
.github/workflows/premerge.yaml | 22 +++++++++++++++++++---
1 file changed, 19 insertions(+), 3 deletions(-)
diff --git a/.github/workflows/premerge.yaml b/.github/workflows/premerge.yaml
index c22b35e122b9fc..956760feaa3b52 100644
--- a/.github/workflows/premerge.yaml
+++ b/.github/workflows/premerge.yaml
@@ -5,6 +5,17 @@ permissions:
on:
pull_request:
+ types:
+ - opened
+ - synchronize
+ - reopened
+ # When a PR is closed, we still start this workflow, but then skip
+ # all the jobs, which makes it effectively a no-op. The reason to
+ # do this is that it allows us to take advantage of concurrency groups
+ # to cancel in progress CI jobs whenever the PR is closed.
+ - closed
+ paths:
+ - .github/workflows/premerge.yaml
push:
branches:
- 'main'
@@ -12,7 +23,9 @@ on:
jobs:
premerge-checks-linux:
- if: false && github.repository_owner == 'llvm'
+ if: >-
+ false && github.repository_owner == 'llvm' &&
+ (github.event_name != 'pull_request' || github.event.action != 'closed')
runs-on: llvm-premerge-linux-runners
concurrency:
group: ${{ github.workflow }}-linux-${{ github.event.pull_request.number || github.sha }}
@@ -71,7 +84,9 @@ jobs:
./.ci/monolithic-linux.sh "$(echo ${linux_projects} | tr ' ' ';')" "$(echo ${linux_check_targets})" "$(echo ${linux_runtimes} | tr ' ' ';')" "$(echo ${linux_runtime_check_targets})"
premerge-checks-windows:
- if: false && github.repository_owner == 'llvm'
+ if: >-
+ false && github.repository_owner == 'llvm' &&
+ (github.event_name != 'pull_request' || github.event.action != 'closed')
runs-on: llvm-premerge-windows-runners
concurrency:
group: ${{ github.workflow }}-windows-${{ github.event.pull_request.number || github.sha }}
@@ -139,7 +154,8 @@ jobs:
if: >-
github.repository_owner == 'llvm' &&
(startswith(github.ref_name, 'release/') ||
- startswith(github.base_ref, 'release/'))
+ startswith(github.base_ref, 'release/')) &&
+ (github.event_name != 'pull_request' || github.event.action != 'closed')
steps:
- name: Checkout LLVM
uses: actions/checkout at v4
More information about the llvm-branch-commits
mailing list