|
| 1 | +--- |
| 2 | +name: check-pr |
| 3 | +description: > |
| 4 | + Check a single PR's CI status, review comments, and requested changes. |
| 5 | + Fix actionable failures and address feedback. "check PR 1234", "what's |
| 6 | + the status of my PR", "address review comments on #500". |
| 7 | +argument-hint: "<pr-number>" |
| 8 | +context: fork |
| 9 | +--- |
| 10 | + |
| 11 | +# Check PR |
| 12 | + |
| 13 | +Do one pass over PR **$ARGUMENTS**: check CI, read reviews, fix what's |
| 14 | +actionable, report status. |
| 15 | + |
| 16 | +## 1. Gather PR state |
| 17 | + |
| 18 | +```bash |
| 19 | +# Overall state |
| 20 | +gh pr view $ARGUMENTS --repo docker/docs --json state,title,url,headRefName |
| 21 | + |
| 22 | +# CI checks |
| 23 | +gh pr checks $ARGUMENTS --repo docker/docs --json name,state,detailsUrl |
| 24 | + |
| 25 | +# Top-level reviews |
| 26 | +gh pr view $ARGUMENTS --repo docker/docs --json reviews,reviewDecision |
| 27 | + |
| 28 | +# Inline (line-level) comments — NOT included in the above |
| 29 | +gh api repos/docker/docs/pulls/$ARGUMENTS/comments \ |
| 30 | + --jq '[.[] | {id: .id, author: .user.login, body: .body, path: .path, line: .line}]' |
| 31 | +``` |
| 32 | + |
| 33 | +Always check both the reviews endpoint and the inline comments endpoint. |
| 34 | +A review with an empty body may still have line-level comments requiring |
| 35 | +action. |
| 36 | + |
| 37 | +## 2. If merged |
| 38 | + |
| 39 | +Report the final state. No further action needed. |
| 40 | + |
| 41 | +## 3. If closed without merge |
| 42 | + |
| 43 | +Read the closing context to understand why: |
| 44 | + |
| 45 | +```bash |
| 46 | +gh pr view $ARGUMENTS --repo docker/docs --json closedAt,comments \ |
| 47 | + --jq '{closedAt, lastComment: .comments[-1].body}' |
| 48 | +``` |
| 49 | + |
| 50 | +Report the reason. Common causes: rejected by maintainers, superseded by |
| 51 | +another PR, closed by automation. |
| 52 | + |
| 53 | +## 4. If CI is failing |
| 54 | + |
| 55 | +- Read the failure details (follow `detailsUrl` if needed) |
| 56 | +- Determine if the failure is in the PR's changed files or pre-existing |
| 57 | +- **Actionable:** check out the branch, fix, commit, push |
| 58 | + ```bash |
| 59 | + git checkout <branch> |
| 60 | + # fix the issue |
| 61 | + git add <files> |
| 62 | + git commit -m "fix: <description>" |
| 63 | + git push |
| 64 | + ``` |
| 65 | +- **Pre-existing / upstream:** note it, do not block |
| 66 | + |
| 67 | +## 5. If review comments or changes requested |
| 68 | + |
| 69 | +- Read each unresolved comment |
| 70 | +- Address feedback in a follow-up commit |
| 71 | +- Push, then reply to each comment explaining what was done: |
| 72 | + ```bash |
| 73 | + gh api repos/docker/docs/pulls/$ARGUMENTS/comments \ |
| 74 | + --method POST \ |
| 75 | + --field in_reply_to=<comment-id> \ |
| 76 | + --field body="<response>" |
| 77 | + ``` |
| 78 | +- End every comment with a `Generated by [Claude Code](https://claude.com/claude-code)` footer |
| 79 | +- Re-request review if changes were requested |
| 80 | + |
| 81 | +## 6. Report |
| 82 | + |
| 83 | +``` |
| 84 | +## PR #$ARGUMENTS: <title> |
| 85 | +
|
| 86 | +**State:** <open|merged|closed> |
| 87 | +**CI:** <passing|failing|pending> |
| 88 | +**Review:** <approved|changes requested|pending> |
| 89 | +**Action taken:** <what was done, or "none needed"> |
| 90 | +``` |
0 commit comments