[llvm] [Github] Cancel previous in-progress code formatting jobs (PR #106701)

Aiden Grossman via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 30 03:12:29 PDT 2024


https://github.com/boomanaiden154 created https://github.com/llvm/llvm-project/pull/106701

If the user pushes multiple times in relatively rapid succession, we might end up with multiple code formatting jobs in flight at the same time for different revisions of the same PR. It makes no sense to keep jobs running on outdated versions of the PR.

Additionally, if my hypothesis proves correct, this might end up fixing

>From 7fbc31d708a94da9dc4de32edec0d14cdf7d8817 Mon Sep 17 00:00:00 2001
From: Aiden Grossman <aidengrossman at google.com>
Date: Fri, 30 Aug 2024 10:06:54 +0000
Subject: [PATCH] [Github] Cancel previous in-progress code formatting jobs

If the user pushes multiple times in relatively rapid succession, we
might end up with multiple code formatting jobs in flight at the same
time for different revisions of the same PR. It makes no sense to keep
jobs running on outdated versions of the PR.

Additionally, if my hypothesis proves correct, this might end up fixing
---
 .github/workflows/pr-code-format.yml | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/.github/workflows/pr-code-format.yml b/.github/workflows/pr-code-format.yml
index 1a1700b75cfdb7..f2bb37316d3a8b 100644
--- a/.github/workflows/pr-code-format.yml
+++ b/.github/workflows/pr-code-format.yml
@@ -13,6 +13,9 @@ jobs:
   code_formatter:
     runs-on: ubuntu-latest
     timeout-minutes: 30
+    concurrency:
+      group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
+      cancel-in-progress: true
     if: github.repository == 'llvm/llvm-project'
     steps:
       - name: Fetch LLVM sources



More information about the llvm-commits mailing list