-
Notifications
You must be signed in to change notification settings - Fork 13.5k
workflows: Automatically make backport requests from merged PRs #126993
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
base: main
Are you sure you want to change the base?
Conversation
This adds a new workflow called pr-release-workflow, which will automatically create backport requests for merged PRs with the latest Release Milestone. This way users can simply add the milestone to PRs with fixes that they want to backport and no longer need to manually add the comments. However, you do still need to use the comments if you are making a backport request from an issue.
@llvm/pr-subscribers-github-workflow Author: Tom Stellard (tstellar) ChangesThis adds a new workflow called pr-release-workflow, which will automatically create backport requests for merged PRs with the latest Release Milestone. This way users can simply add the milestone to PRs with fixes that they want to backport and no longer need to manually add the comments. However, you do still need to use the comments if you are making a backport request from an issue. Full diff: https://github.com/llvm/llvm-project/pull/126993.diff 2 Files Affected:
diff --git a/.github/workflows/pr-release-workflow.yml b/.github/workflows/pr-release-workflow.yml
new file mode 100644
index 0000000000000..ca4711ef039d1
--- /dev/null
+++ b/.github/workflows/pr-release-workflow.yml
@@ -0,0 +1,29 @@
+name: PR Release Workflow
+
+permissions:
+ contents: read
+
+on:
+ pull_request:
+ types:
+ - milestoned
+ - closed
+
+jobs:
+ backport-commit:
+ runs-on: ubuntu-22.04
+ if: >-
+ github.repository == 'llvm/llvm-project' &&
+ github.event.pull_request.merged &&
+ contains(github.event.pull_request.milestone.title, 'Release')
+ steps:
+ - uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea #v7.0.1
+ with:
+ github-token: ${{ secrets.ISSUE_SUBSCRIBER_TOKEN }}
+ script: |
+ github.rest.issues.createComment({
+ issue_number: context.issue.number,
+ owner: context.repo.owner,
+ repo: context.repo.repo,
+ body: `/cherry-pick ${context.sha}`
+ });
diff --git a/llvm/docs/GitHub.rst b/llvm/docs/GitHub.rst
index b5b75db91e1c4..5f1fb4d9da29f 100644
--- a/llvm/docs/GitHub.rst
+++ b/llvm/docs/GitHub.rst
@@ -437,12 +437,14 @@ Releases
Backporting Fixes to the Release Branches
-----------------------------------------
-You can use special comments on issues or pull requests to make backport
-requests for the release branches. To do this, after your pull reuest has been
-merged:
-1. Edit "Milestone" at the right side of the isssue or pull request
- to say "LLVM X.Y Release"
+Issues
+^^^^^^
+
+You can use special comments on issues to make backport requests for the
+release branches. To do this:
+
+1. Edit "Milestone" at the right side of the issue to say "LLVM X.Y Release"
2. Add a comment to it in the following format:
@@ -460,6 +462,20 @@ If a commit you want to backport does not apply cleanly, you may resolve
the conflicts locally and then create a pull request against the release
branch. Just make sure to add the release milestone to the pull request.
+
+Pull Requests
+^^^^^^^^^^^^^
+
+If you add the current Release Milestone to a pull request, then a backport
+request will be made automatically without the need to add any additional
+comments like you must do for issues. You can even add the Milestone after
+the pull request has been merged and the backport request will still automatically
+be created.
+
+If for some reason the automation doesn't work, you may also manually request a
+backport by following the same steps listed above for issues.
+
+
Getting admin access to CI infrastructure
=========================================
|
Error: Command failed due to missing milestone. |
For some reason the issue-release-workflow triggered on this: https://github.com/llvm/llvm-project/actions/runs/13298256945/job/37134833231 |
Oh I see, it saw |
Error: Command failed due to missing milestone. |
OK, I'll stop now :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor nits, otherwise LGTM from a GHA perspective and seems like a decent workflow improvement, but it would be good for someone else to look that over as well.
|
||
jobs: | ||
backport-commit: | ||
runs-on: ubuntu-22.04 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ubuntu-24.04
here? I want to start migrating things soonish, and it doesn't seem like anything will break for this workflow by bumping it.
|
||
If you add the current Release Milestone to a pull request, then a backport | ||
request will be made automatically without the need to add any additional | ||
comments like you must do for issues. You can even add the Milestone after |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: s/Milestrone/milestone
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A possible problem here is that some PRs require also cherry-picking a separate test commit. In that case adding them to the milestone will always produce an incorrect first cherry-pick command.
if: >- | ||
github.repository == 'llvm/llvm-project' && | ||
github.event.pull_request.merged && | ||
contains(github.event.pull_request.milestone.title, 'Release') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't check that the PR targets the current Release milestone. So, AFAICT, if I create a milestone for the next release (LLVM 21) and I merge a PR, it would get automatically cherry-picked onto the release branch. I don't think that's intended.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They cherry-pick step would fail, because the github-automation.py script looks for the branch name in the description of the milestone. So if the milestone was for LLVM 21, it would try to cherry-pick to release/21.x and fail. If this happened, there wouldn't be a very descriptive error message, so we could do something to make the error reason more clear.
This adds a new workflow called pr-release-workflow, which will automatically create backport requests for merged PRs with the latest Release Milestone. This way users can simply add the milestone to PRs with fixes that they want to backport and no longer need to manually add the comments.
However, you do still need to use the comments if you are making a backport request from an issue.