| 1 | --- |
| 2 | name: gh-assign-issues |
| 3 | description: "Use to assign GitHub issues to a milestone and/or owners in bulk, verifying each." |
| 4 | --- |
| 5 | |
| 6 | # gh-assign-issues |
| 7 | |
| 8 | Retarget or assign a set of CodeWhale issues to a milestone and/or owners in |
| 9 | bulk, verifying every one. The milestone (or assignee) change is the signal; |
| 10 | do not narrate it with comments. Use `gh` for all GitHub |
| 11 | calls. |
| 12 | |
| 13 | ## When to use |
| 14 | |
| 15 | - You have a concrete list of issue numbers (e.g. from triage) to move into a |
| 16 | release milestone such as `v0.8.61`, or to assign to owners. |
| 17 | - A milestone was renamed/created and its issues need re-pointing. |
| 18 | - You finished grouping the inbox and want the queue to reflect it without |
| 19 | posting public chatter. |
| 20 | |
| 21 | This skill changes milestone/assignee only. It does not close, label, comment, |
| 22 | merge, or release. Those stay with the maintainer. |
| 23 | |
| 24 | ## Workflow |
| 25 | |
| 26 | 1. Confirm the exact milestone title. `gh issue edit --milestone` matches by |
| 27 | name, so a typo silently fails (or worse, no-ops). Read the real titles and |
| 28 | note the starting open-count: |
| 29 | |
| 30 | ```bash |
| 31 | gh api repos/Hmbown/CodeWhale/milestones \ |
| 32 | --jq '.[] | "\(.number)\t\(.title)\topen=\(.open_issues)\tstate=\(.state)"' |
| 33 | ``` |
| 34 | |
| 35 | Copy the title string verbatim (e.g. `v0.8.61`). If the target milestone is |
| 36 | missing or closed, stop and ask the maintainer; do not create one. |
| 37 | |
| 38 | 2. Pre-flight each number. `gh issue edit` will happily retarget a PR or a |
| 39 | closed issue, so screen first. The `url` reveals PR-vs-issue (`/pull/` vs |
| 40 | `/issues/`); skip anything not OPEN or that is a PR: |
| 41 | |
| 42 | ```bash |
| 43 | for N in 3101 3102 3103; do |
| 44 | gh issue view "$N" --repo Hmbown/CodeWhale \ |
| 45 | --json number,state,url,milestone \ |
| 46 | --jq '"\(.number)\t\(.state)\t\(.url)\tmilestone=\(.milestone.title // "none")"' |
| 47 | done |
| 48 | ``` |
| 49 | |
| 50 | Flag any row whose `url` contains `/pull/` (it is a PR) or whose state is |
| 51 | not `OPEN`, and exclude it from the loop below. |
| 52 | |
| 53 | 3. Apply the change, one issue at a time, reporting per-issue success. Use |
| 54 | `--milestone`, `--add-assignee`, or both: |
| 55 | |
| 56 | ```bash |
| 57 | for N in 3101 3102 3103; do |
| 58 | if gh issue edit "$N" --repo Hmbown/CodeWhale \ |
| 59 | --milestone "v0.8.61" >/dev/null 2>&1; then |
| 60 | echo "ok #$N -> v0.8.61" |
| 61 | else |
| 62 | echo "FAIL #$N (PR? closed? bad milestone title?)" |
| 63 | fi |
| 64 | done |
| 65 | # owners: add --add-assignee handle (do not invent logins) |
| 66 | ``` |
| 67 | |
| 68 | Edit is idempotent: re-pointing an already-correct issue is harmless. |
| 69 | |
| 70 | 4. Verify the milestone moved. Re-run the step-1 command and confirm the open |
| 71 | count rose by the number of issues you moved in (minus any you skipped). |
| 72 | Spot-check a few with the step-2 view to confirm `milestone.title` is now |
| 73 | the target. |
| 74 | |
| 75 | 5. Report a tight ledger: issues moved, issues skipped and why (PR / closed / |
| 76 | title mismatch), the before/after open-count, and any owner assignments. |
| 77 | No public comment is posted. |
| 78 | |
| 79 | ## Red flags / don't |
| 80 | |
| 81 | - Don't edit from a list of titles alone. Resolve to OPEN issue numbers and |
| 82 | confirm each is an issue, not a PR (`/pull/` in the url), before editing. |
| 83 | - Don't guess the milestone title or assignee login. A near-miss name no-ops |
| 84 | or fails silently; an invalid login errors mid-loop. |
| 85 | - Don't post "moved to v0.8.61" comments. The milestone change is the signal; |
| 86 | extra chatter is noise to good-faith contributors. |
| 87 | - Don't close, merge, label, tag, or release as part of this. Those need |
| 88 | explicit maintainer approval (see AGENTS.md). |
| 89 | - Don't skip step 4. An unmoved open-count means the title was wrong or every |
| 90 | edit silently failed. |
| 91 | - Preserve contributor credit: this skill never alters authorship, harvest |
| 92 | trailers (`Co-authored-by` / `Harvested-from`), or closclosing references. |
| 93 |