-
Notifications
You must be signed in to change notification settings - Fork 386
[Cherry-pick] PRs #1352 #1351 #1330 #1354 #1355 #1360 #1342 #1324 #1340 #1368 #1373 #1359 #1361 #1325 #1369 #1370 #1371 #1375 #1386 #1353 #1356 #1390 #1385
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
Changes from all commits
5d50c73
57eb6b7
816da0f
8abe394
3383a20
34d554f
484acbf
e906fb6
82a856d
f06190b
4879789
1aa5775
e88857d
bc89749
0f9ef85
d3d519d
1b2f029
3720a7a
1f619ce
c07841a
55c338f
fc24813
e3d3321
6b9f370
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 |
|---|---|---|
| @@ -0,0 +1,89 @@ | ||
| --- | ||
| name: release-cherry-pick | ||
| description: Cherry-pick merged PRs labeled for a release branch into that branch, then open a PR and apply the cherry-pick-done label. Use when asked to "cherry-pick PRs for release/X.Y.Z", "pick PRs to release branch", or "cherry-pick labeled PRs". | ||
| --- | ||
|
|
||
| # Cherry-pick PRs to a Release Branch | ||
|
|
||
| Cherry-pick all merged `main` PRs labeled `cherry-pick-<version>` (but not `cherry-pick-done`) into the corresponding `release/<version>` branch, one by one in merge order. | ||
|
|
||
| ## Step 1 — Identify the target version | ||
|
|
||
| Ask the user for the release version (e.g. `0.44.0`) if not already provided. | ||
|
|
||
| Set `VERSION=<version>` for use in subsequent steps. | ||
|
|
||
| ## Step 2 — Fetch pending PRs | ||
|
|
||
| Use the GitHub search API to list PRs that have the cherry-pick label but not cherry-pick-done, sorted by merge date ascending: | ||
|
|
||
| ```bash | ||
| gh api "search/issues?q=repo:NVIDIA/Model-Optimizer+is:pr+is:merged+base:main+label:cherry-pick-<VERSION>+-label:cherry-pick-done&sort=updated&order=asc&per_page=50" \ | ||
| --jq '.items[] | [.number, .title, .pull_request.merged_at] | @tsv' \ | ||
| | sort -t$'\t' -k3 | ||
| ``` | ||
|
|
||
| Present the list to the user before proceeding. | ||
|
|
||
| ## Step 3 — Set up the release branch | ||
|
|
||
| Check out `release/<VERSION>`, creating it from the remote if it doesn't exist locally: | ||
|
|
||
| ```bash | ||
| git fetch origin release/<VERSION> | ||
| git checkout release/<VERSION> | ||
| ``` | ||
|
Comment on lines
+28
to
+35
Contributor
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. Clarify release branch creation behavior. The description states "creating it from the remote if it doesn't exist locally," but the provided commands will fail if the 📝 Suggested clarificationEither update the description to reflect the actual behavior: -Check out `release/<VERSION>`, creating it from the remote if it doesn't exist locally:
+Check out the existing `release/<VERSION>` branch from the remote:Or provide commands that handle both cases: +If the release branch doesn't exist yet, create it from main:
+
+```bash
+git fetch origin
+if git rev-parse --verify origin/release/<VERSION> >/dev/null 2>&1; then
+ git checkout release/<VERSION>
+else
+ git checkout -b release/<VERSION> origin/main
+ git push -u origin release/<VERSION>
+fi
+```
+
+Otherwise, check out the existing branch:
+
```bash
git fetch origin release/<VERSION>
git checkout release/<VERSION>Verify each finding against current code. Fix only still-valid issues, skip the In @.claude/skills/release-cherry-pick/SKILL.md around lines 28 - 35, The |
||
|
|
||
| ## Step 4 — Get merge commit SHAs | ||
|
|
||
| All PRs are squash-merged, so each has a single-parent commit. Retrieve the SHA for each PR: | ||
|
|
||
| ```bash | ||
| gh pr view <NUM> --repo NVIDIA/Model-Optimizer --json mergeCommit --jq '.mergeCommit.oid' | ||
| ``` | ||
|
|
||
| ## Step 5 — Cherry-pick in merge order | ||
|
|
||
| Cherry-pick each commit with `-s` (DCO sign-off). GPG signing is handled automatically by the repo's git config. | ||
|
|
||
| ```bash | ||
| git cherry-pick -s <SHA> | ||
| ``` | ||
|
|
||
| **On conflict:** Tell the user which PR caused the conflict and ask them to fix it, then continue: | ||
|
|
||
| ```bash | ||
| git cherry-pick --continue | ||
| ``` | ||
|
|
||
| ## Step 6 — Create a PR to the release branch | ||
|
|
||
| Push the cherry-picks to a new branch and open a PR targeting `release/<VERSION>`. The PR title lists every cherry-picked PR number. The body uses `## Cherry-picked PRs` as the only heading with one `- #<NUM>` bullet per PR — no titles, no links, no extra text. | ||
|
|
||
| ```bash | ||
| git checkout -B cherry-picks/release-<VERSION> | ||
| git push -u origin cherry-picks/release-<VERSION> | ||
|
|
||
| gh pr create \ | ||
| --title "[Cherry-pick] PRs #<NUM1> #<NUM2> ..." \ | ||
| --base release/<VERSION> \ | ||
| --head cherry-picks/release-<VERSION> \ | ||
| --body "$(cat <<'EOF' | ||
| ## Cherry-picked PRs | ||
|
|
||
| - #<NUM1> | ||
| - #<NUM2> | ||
| ... | ||
| EOF | ||
| )" | ||
| ``` | ||
|
|
||
| ## Step 7 — Apply cherry-pick-done label | ||
|
|
||
| Add the `cherry-pick-done` label to every PR that was successfully cherry-picked: | ||
|
|
||
| ```bash | ||
| for pr in <NUM1> <NUM2> ...; do | ||
| gh pr edit $pr --repo NVIDIA/Model-Optimizer --add-label "cherry-pick-done" | ||
| done | ||
| ``` | ||
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.
Handle pagination for repositories with many pending cherry-picks.
The GitHub API query uses
per_page=50, which limits results to 50 PRs. If more than 50 PRs are labeledcherry-pick-<VERSION>withoutcherry-pick-done, later PRs will be silently omitted from the cherry-pick batch.📄 Suggested approaches
Option 1: Increase the page size to a safer limit:
Option 2: Add pagination using
--paginate:📝 Committable suggestion
🤖 Prompt for AI Agents