pr-review-response
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChinesePR Review Response
PR评论响应
This skill helps you extract comments from a GitHub Pull Request and act on the feedback.
本技能可帮助你从GitHub Pull Request中提取评论并根据反馈采取行动。
Input
输入
Accept a GitHub PR URL in the format:
https://github.com/{owner}/{repo}/pull/{number}Parse the URL to extract:
- : Repository owner
owner - : Repository name
repo - : PR number
number
接受格式为 的GitHub PR URL
https://github.com/{owner}/{repo}/pull/{number}解析URL以提取:
- :仓库所有者
owner - :仓库名称
repo - :PR编号
number
Extracting Comments
提取评论
Use the CLI to fetch all types of PR comments:
gh使用 CLI获取所有类型的PR评论:
gh1. Review Comments (inline comments on code)
1. 审核评论(代码上的行内评论)
bash
gh api repos/{owner}/{repo}/pulls/{number}/commentsThese comments include:
- : File path the comment references
path - or
line: Line numberoriginal_line - : Comment text
body - : Code context
diff_hunk
bash
gh api repos/{owner}/{repo}/pulls/{number}/comments这些评论包含:
- :评论关联的文件路径
path - 或
line:行号original_line - :评论内容
body - :代码上下文
diff_hunk
2. PR Reviews (approval/request changes with summary)
2. PR审核(带总结的批准/修改请求)
bash
gh api repos/{owner}/{repo}/pulls/{number}/reviewsThese include:
- : Review summary
body - : APPROVED, CHANGES_REQUESTED, COMMENTED
state
bash
gh api repos/{owner}/{repo}/pulls/{number}/reviews这些内容包含:
- :审核总结
body - :APPROVED(已批准)、CHANGES_REQUESTED(需要修改)、COMMENTED(仅评论)
state
3. General PR Comments (conversation thread)
3. 通用PR评论(对话线程)
bash
gh api repos/{owner}/{repo}/issues/{number}/commentsThese are discussion comments not tied to specific lines.
bash
gh api repos/{owner}/{repo}/issues/{number}/comments这些是不关联到特定代码行的讨论类评论。
Processing Comments
处理评论
- Group by file: Organize inline comments by their field
path - Classify feedback by intent:
- Change requests — explicit directives to modify code (e.g. "please change", "should be", "fix", "update")
- Open questions — inquiries that require investigation or clarification
- Enhancement suggestions — non-blocking recommendations for improvement
- Prioritize: Address blocking comments (from CHANGES_REQUESTED reviews) first
- 按文件分组:根据字段将行内评论分类整理
path - 按意图分类反馈:
- 修改请求 —— 明确要求修改代码的指令(例如“请修改”、“应该是”、“修复”、“更新”)
- 开放式问题 —— 需要调查或澄清的疑问
- 优化建议 —— 非阻塞性的改进建议
- 优先级排序:优先处理来自CHANGES_REQUESTED类型审核的阻塞性评论
Acting on Feedback
根据反馈采取行动
For each actionable comment:
- Read the referenced file to understand the current code
- Fix problems at the root: Don't apply superficial fixes. Investigate and address the underlying cause of the issue, not just the symptom mentioned in the comment
- Apply requested changes using the Edit tool
- For questions: Investigate and provide answers or make clarifying changes
- For suggestions: Evaluate and implement if appropriate
- Add tests for edge cases: If the feedback identifies an edge case and the project has testing already set up, add a test to cover that edge case to prevent regression
对于每个可执行的评论:
- 阅读关联文件以理解当前代码
- 从根源解决问题:不要仅做表面修复。调查并解决问题的根本原因,而不只是评论中提到的症状
- 使用编辑工具应用所需修改
- 针对问题:调查并提供答案或做出澄清性修改
- 针对建议:评估后酌情实施
- 添加边缘情况测试:如果反馈指出了边缘情况,且项目已设置测试机制,添加测试覆盖该边缘情况以防止回归
Example Workflow
示例流程
Given :
https://github.com/acme/app/pull/42- Extract: owner=, repo=
acme, number=app42 - Fetch comments:
bash
gh api repos/acme/app/pulls/42/comments gh api repos/acme/app/pulls/42/reviews gh api repos/acme/app/issues/42/comments - Parse the JSON responses to identify feedback
- For each comment with a file path, read that file and apply changes
- Summarize what was addressed
给定URL :
https://github.com/acme/app/pull/42- 提取信息:owner=,repo=
acme,number=app42 - 获取评论:
bash
gh api repos/acme/app/pulls/42/comments gh api repos/acme/app/pulls/42/reviews gh api repos/acme/app/issues/42/comments - 解析JSON响应以识别反馈内容
- 对于每个关联了文件路径的评论,读取对应文件并应用修改
- 总结已处理的内容
Output
输出
After processing, provide a summary of:
- Number of comments found
- Actions taken for each comment
- Any comments that need clarification or manual review
处理完成后,提供以下内容的总结:
- 找到的评论数量
- 针对每条评论采取的行动
- 任何需要澄清或手动审核的评论