Skip to content

[Github] Cancel previous in-progress code formatting jobs #106701

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

boomanaiden154
Copy link
Contributor

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

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
@llvmbot
Copy link
Member

llvmbot commented Aug 30, 2024

@llvm/pr-subscribers-github-workflow

Author: Aiden Grossman (boomanaiden154)

Changes

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


Full diff: https://github.com/llvm/llvm-project/pull/106701.diff

1 Files Affected:

  • (modified) .github/workflows/pr-code-format.yml (+3)
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

@boomanaiden154
Copy link
Contributor Author

CC @nicovank

This doesn't replace the need to get rid of the checkout through merge base step in this workflow, but if this actually fixes the underlying timeout issue, that turns into an optimization rather than a correctness issue.

Once this lands, I'll monitor the run time of the PR code format job to see if there are any new timeouts to confirm if we've fixed it or not.

@boomanaiden154 boomanaiden154 merged commit 1293ab3 into llvm:main Aug 30, 2024
8 checks passed
@boomanaiden154 boomanaiden154 deleted the pr-code-format-concurrency-group branch August 30, 2024 21:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants