pr-feedback-workflow

majiayu000 的头像作者 majiayu000

一次性处理所有 PR 反馈。一起获取审阅意见和 CI 失败,创建统一的行动计划,应用修复,回复审阅者,解决线程并发布摘要。当被要求解决 PR​​ 反馈、修复评审意见、处理 CI 失败或处理 PR 评审时使用。致力于当前分支的公开 PR。

📖 中文导读:一次性处理所有 PR 反馈。一起获取审阅意见和 CI 失败,创建统一的行动计划,应用修复,回复审阅者,解决线程并发布摘要。当被要求解决 PR​​ 反馈、修复评审意见、处理 CI 失败或处理 PR 评审时使用。致力于当前分支的公开 PR。 以下正文为该技能的原始 SKILL.md 内容(英文),上方安装命令可直接使用。

name: pr-feedback-workflow description: Process all PR feedback in one pass. Fetches review comments and CI failures together, creates a unified action plan, applies fixes, replies to reviewers, resolves threads, and posts a summary. Use when asked to address PR feedback, fix review comments, handle CI failures, or process PR reviews. Works on the current branch's open PR.

PR Feedback Workflow

Gather all PR feedback (review comments + CI failures), plan holistically, then execute.

Phase 1: Gather Context

Run both scripts to collect all feedback:

scripts/load-pr-feedback.sh

This fetches:

  • PR number, title, and current branch
  • All review comments with thread IDs
  • All review threads (resolved and unresolved)
  • Latest CI/CD run status and failure logs (if any)

Phase 2: Analyse

For each piece of feedback (conversation comments, code review comments, CI failures), categorise:

Category Action
Code fix required Note the file, change needed, and which comments/CI failures it addresses
No change needed Prepare explanation for reviewer
Out of scope Prepare to create a new issue and link it
CI-only failure Note the fix needed (may overlap with review comments)
General question/discussion Prepare appropriate response

Look for overlaps where one fix addresses multiple items.

Note the comment type (conversation vs review) as they use different reply mechanisms.

Phase 3: Create Unified Plan

Before making changes, output a plan:

  1. Code changes to make (grouped by file)
  2. Which review comments each change addresses
  3. Which CI failures each change fixes
  4. Comments that need explanation-only replies
  5. Out-of-scope items to convert to issues

Ask: "Ready to execute this plan?"

Wait for confirmation.

Phase 4: Execute

1. Apply code fixes

Make all code changes, then commit:

git add -A
git commit -m "Address PR feedback

- [summary of changes]
- Fixes review comments from @reviewer
- Resolves CI failure in [workflow]"
git push

2. Reply to comments

For code review comments (attached to specific lines):

gh api repos/{owner}/{repo}/pulls/comments/{comment_id}/replies \
  -f body="✅ Fixed: [description of change]"

For PR conversation comments (general discussion):

gh pr comment {PR_NUMBER} -b "Replying to @{author}: [response]"

Reply templates:

  • Fix applied: ✅ Fixed: [what was changed]
  • No change needed: ℹ️ No change required: [explanation]
  • Out of scope: 📝 Good suggestion, tracked as #[issue_number]
  • Acknowledgement: 👍 Thanks for the feedback, [response]

3. Create issues for out-of-scope items

gh issue create \
  -t "Enhancement: [title]" \
  -b "Suggested during PR review of #[PR_NUMBER].

## Context
[Original comment]

## Suggested approach
[Implementation ideas]"

4. Resolve review threads

Use the helper script:

scripts/resolve-thread.sh <THREAD_ID>

Or manually via GraphQL:

gh api graphql -f query='
  mutation {
    resolveReviewThread(input: {threadId: "<THREAD_ID>"}) {
      thread { id isResolved }
    }
  }'

5. Verify CI passes

Wait for CI to complete after pushing:

gh run watch

If still failing, repeat analysis on new logs.

Phase 5: Summarise and Approve

Post a summary comment and approve:

gh pr comment -b "## PR Feedback Summary

### Review Comments
- ✅ X comments addressed with code changes
- ℹ️ Y comments resolved with explanations  
- 📝 Z suggestions tracked as new issues

### CI/CD
- [Status of workflow runs]

### Changes Made
- [List of commits/changes]

All feedback has been addressed."

gh pr review --approve -b "All review comments addressed and CI passing."

Scripts Reference

Script Purpose
scripts/load-pr-feedback.sh Fetches PR comments, threads, and CI status
scripts/resolve-thread.sh Resolves a review thread by ID