|
1 | 1 | --- |
2 | 2 | name: pr-review |
3 | | -description: Address review comments from GitHub PR using gh CLI and resolve feedback |
| 3 | +description: Address review comments and CI failures for the current branch's PR |
4 | 4 | --- |
5 | 5 |
|
6 | | -## When to use |
7 | | - |
8 | | -- Current branch has a PR with review comments requiring responses |
9 | | -- Need to systematically evaluate and resolve reviewer feedback |
10 | | - |
11 | 6 | ## Constraints |
12 | 7 |
|
13 | | -- **ALWAYS** set `PAGER=cat` before calling `gh` to avoid pagination issues |
14 | | -- Use `gh pr view <PR_NUMBER> --comments` to fetch review comments |
15 | | -- Use `gh pr list --head <CURRENT_BRANCH>` to find the PR number for the current branch |
| 8 | +- Prepend `GH_PAGER=` to every `gh` command (bash/zsh), or set `$env:GH_PAGER=""` in PowerShell — never modify global config |
| 9 | +- Key commands: `gh pr list --head <BRANCH>` · `gh pr view <PR> --comments` · `gh pr checks <PR>` · `gh run view <RUN_ID> --log-failed` |
| 10 | +- Workflow fixes **cannot be verified locally** — the fix is only confirmed once the remote CI re-runs and passes |
16 | 11 |
|
17 | 12 | ## Procedure |
18 | 13 |
|
19 | | -1. **Find Issues**: Use `gh` to locate the PR for current branch and retrieve all review comments |
20 | | -2. **Evaluate**: Analyze each comment in project context: |
21 | | - - If valid: implement the necessary code improvements |
22 | | - - If invalid: document reasons and address any underlying real issues |
23 | | -3. **Summarize**: Provide a summary covering: |
24 | | - - Valid points and how they were resolved |
25 | | - - Invalid points and reasons for rejection |
26 | | - - Any additional issues discovered and fixed |
27 | | -4. **Commit**: Generate commit message, then `git commit` and `git push` |
| 14 | +1. **Locate PR** — get PR number for current branch |
| 15 | +2. **Fix CI failures** — for each failing check: |
| 16 | + - Fetch logs: `gh run view <RUN_ID> --log-failed` |
| 17 | + - **Workflow issue** (wrong config, missing step, bad path): |
| 18 | + 1. Fix `.github/workflows/` directly |
| 19 | + 2. Commit & push the workflow change |
| 20 | + 3. Wait for the re-triggered run to complete: poll with `GH_PAGER= gh pr checks <PR>` (or `GH_PAGER= gh run watch <RUN_ID>`) until the affected check finishes |
| 21 | + 4. If it **passes** → continue to the next failing check |
| 22 | + 5. If it **still fails** → fetch new logs (`gh run view <NEW_RUN_ID> --log-failed`) and repeat from step i |
| 23 | + - **Code issue, non-breaking**: fix source code directly |
| 24 | + - **Code issue, breaking change required**: stop and report to developer for a decision |
| 25 | +3. **Address review comments** — implement valid feedback; document why invalid ones are rejected |
| 26 | +4. **Commit & push** — single commit covering all non-workflow fixes (workflow fixes are pushed incrementally during step 2) |
| 27 | +5. **Final verification** — once all fixes are applied, confirm every check is green: `GH_PAGER= gh pr checks <PR>` |
28 | 28 |
|
29 | 29 | ## Output |
30 | 30 |
|
31 | | -- Clear mapping between review comments and their resolutions |
| 31 | +- Per CI failure: root cause and resolution (or escalation reason) |
| 32 | +- Per review comment: resolution or rejection reason |
| 33 | +- After all fixes: summary of check statuses confirming all green |
0 commit comments