-
-
Notifications
You must be signed in to change notification settings - Fork 32.5k
[code-infra] Allow cherry-picking after merge #49207
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: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,13 +5,20 @@ on: | |
| - 'next' | ||
| - 'v*.x' | ||
| - 'master' | ||
| types: ['closed'] | ||
| types: ['closed', 'labeled'] | ||
|
|
||
| permissions: {} | ||
|
|
||
| jobs: | ||
| create_pr: | ||
| name: Create cherry-pick PR | ||
| if: >- | ||
| ${{ github.event.pull_request.merged && | ||
| contains(github.event.pull_request.labels.*.name, 'needs cherry-pick') && ( | ||
| github.event.action == 'closed' || | ||
| github.event.label.name == 'needs cherry-pick' || | ||
| (startsWith(github.event.label.name, 'v') && endsWith(github.event.label.name, '.x')) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Claude Opus 5.5 observationAdding a Example: the PR has The shared workflow already has a single-branch mode. We can use it for version-label events: with:
target_branch: ${{ github.event.action == 'labeled' && github.event.label.name != 'needs cherry-pick' && github.event.label.name || '' }}
pr_number: ${{ github.event.action == 'labeled' && github.event.label.name != 'needs cherry-pick' && format('{0}', github.event.pull_request.number) || '' }}The retry path (remove and re-add |
||
| ) }} | ||
| uses: mui/mui-public/.github/workflows/prs_create-cherry-pick-pr.yml@c6471a4fe98cb2e52efe7397ff8362569f2ddada # master | ||
| permissions: | ||
| contents: write | ||
|
|
||
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.
Claude Opus 5.5 observation
If someone adds
needs cherry-pickandv9.xin one label-picker action after merge, GitHub sends onelabeledevent per label. Each payload has the full label list, so both events pass this gate and start two runs.Only one cherry-pick PR opens, because the concurrency group in the shared workflow runs the open step one at a time. But both detect jobs post "Cherry-pick PRs will be created targeting branches: v9.x" on the PR. If one action adds three labels, the newest queued job also cancels the pending job, and a cancelled run shows in the Actions tab.
I did not test this. A possible fix is in mui-public: post the comment from the open job after
gh pr create, and include the new PR URL. The second run then stops at the existing-PR check and posts nothing.