review-pr-comments
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseWe have received comments on the current active pull request. Together, we will go through each comment one by one and discuss whether to accept the change, iterate on it, or reject the change.
我们收到了当前活跃拉取请求上的评论。我们将一起逐条查看每条评论,讨论是接受更改、迭代更改还是拒绝更改。
Steps to follow:
要遵循的步骤:
- Fetch the active pull request: If available, use the tool from the
activePullRequesttoolset to get the details of the active pull request including the comments. If not, use the GitHub MCP server or GitHub CLI to get the details of the active pull request. Fetch both top level comments and inline comments.GitHub Pull Requests - Present a list of the comments with a one-sentence summary of each.
- One at a time, present each comment in full detail and ask me whether to accept, iterate, or reject the change. Provide your recommendation for each comment based on best practices, code quality, and project guidelines. Await user's decision before proceeding to the next comment. DO NOT make any changes to the code or files until I have responded with my decision for each comment.
- If the decision is to accept or iterate, make the necessary code changes to address the comment. If the decision is to reject, provide a brief explanation of why the change was not made.
- Wait for user to affirm completion of any code changes made before moving to the next comment.
- Reply to each comment on the pull request with the outcome of our discussion (accepted, iterated, or rejected) along with any relevant explanations.
- 获取活跃拉取请求:如果可用,使用工具集中的
GitHub Pull Requests工具来获取活跃拉取请求的详细信息,包括评论。如果不可用,使用GitHub MCP服务器或GitHub CLI获取活跃拉取请求的详细信息。同时获取顶层评论和行内评论。activePullRequest - 展示评论列表,每条评论附带一句话摘要。
- 每次完整展示一条评论的详细信息,并询问我是接受、迭代还是拒绝该更改。请基于最佳实践、代码质量和项目指南为每条评论提供你的建议。在进行下一条评论之前等待用户的决定。在我对每条评论回复决定之前,请勿对代码或文件进行任何更改。
- 如果决定是接受或迭代,进行必要的代码更改以解决该评论。如果决定是拒绝,提供简短的解释说明为何不进行该更改。
- 在进入下一条评论之前,等待用户确认已完成所有做出的代码更改。
- 回复拉取请求上的每条评论,说明我们的讨论结果(已接受、已迭代、已拒绝)以及任何相关解释。
How to reply to PR review comments
如何回复PR评审评论
This guide explains how to reply directly to inline review comments on GitHub pull requests.
本指南说明如何直接回复GitHub拉取请求上的行内评审评论。
API Endpoint
API Endpoint
To reply to an inline PR comment, use:
http
POST /repos/{owner}/{repo}/pulls/{pull_number}/comments/{comment_id}/repliesWith body:
json
{
"body": "Your reply message"
}要回复行内PR评论,请使用:
http
POST /repos/{owner}/{repo}/pulls/{pull_number}/comments/{comment_id}/replies请求体:
json
{
"body": "Your reply message"
}Using gh CLI
使用gh CLI
bash
gh api repos/{owner}/{repo}/pulls/{pull_number}/comments/{comment_id}/replies \
-X POST \
-f body="Your reply message"bash
gh api repos/{owner}/{repo}/pulls/{pull_number}/comments/{comment_id}/replies \
-X POST \
-f body="Your reply message"Workflow
工作流
-
Get PR comments: First fetch the PR review comments to get their IDs:bash
gh api repos/{owner}/{repo}/pulls/{pull_number}/comments -
Identify comment IDs: Each comment has anfield. For threaded comments, use the root comment's
id.id -
Post replies: For each comment you want to reply to:bash
gh api repos/{owner}/{repo}/pulls/{pull_number}/comments/{comment_id}/replies \ -X POST \ -f body="Fixed in commit abc123"
-
获取PR评论:首先获取PR评审评论以获取其ID:bash
gh api repos/{owner}/{repo}/pulls/{pull_number}/comments -
识别评论ID:每条评论都有一个字段。对于线程化评论,请使用根评论的
id。id -
发布回复:对于你想要回复的每条评论:bash
gh api repos/{owner}/{repo}/pulls/{pull_number}/comments/{comment_id}/replies \ -X POST \ -f body="Fixed in commit abc123"
Example Replies
示例回复
For accepted changes:
- "Fixed in {commit_sha}"
- "Accepted - fixed in {commit_sha}"
For rejected changes:
- "Rejected - {reason}"
- "Won't fix - {explanation}"
For questions:
- "Good catch, addressed in {commit_sha}"
对于已接受的更改:
- "已在 {commit_sha} 中修复"
- "已接受 - 已在 {commit_sha} 中修复"
对于已拒绝的更改:
- "已拒绝 - {reason}"
- "不会修复 - {explanation}"
对于问题:
- "发现得好,已在 {commit_sha} 中处理"
Notes
注意事项
- The is the numeric ID from the comment object, NOT the
comment_idnode_id - Replies appear as threaded responses under the original comment
- You can reply to any comment, including bot comments (like Copilot reviews)
- 是评论对象中的数字ID,而非
comment_idnode_id - 回复会作为原始评论下的线程化响应显示
- 你可以回复任何评论,包括机器人评论(如Copilot评审)
Resolving Conversations
解决会话
To resolve (mark as resolved) PR review threads, use the GraphQL API:
-
Get thread IDs: Query for unresolved threads:bash
gh api graphql -f query=' query { repository(owner: "{owner}", name: "{repo}") { pullRequest(number: {pull_number}) { reviewThreads(first: 50) { nodes { id isResolved comments(first: 1) { nodes { body path } } } } } } }' -
Resolve threads: Use themutation:
resolveReviewThreadbashgh api graphql -f query=' mutation { resolveReviewThread(input: {threadId: "PRRT_xxx"}) { thread { isResolved } } }' -
Resolve multiple threads at once:bash
gh api graphql -f query=' mutation { t1: resolveReviewThread(input: {threadId: "PRRT_xxx"}) { thread { isResolved } } t2: resolveReviewThread(input: {threadId: "PRRT_yyy"}) { thread { isResolved } } }'
The thread ID starts with and can be found in the GraphQL query response.
PRRT_Note: This skill can be removed once the GitHub MCP server has added built-in support for replying to PR review comments and resolving threads.
See:
https://github.com/github/github-mcp-server/issues/1323
https://github.com/github/github-mcp-server/issues/1768
要解决(标记为已解决)PR评审线程,请使用GraphQL API:
-
获取线程ID:查询未解决的线程:bash
gh api graphql -f query=' query { repository(owner: "{owner}", name: "{repo}") { pullRequest(number: {pull_number}) { reviewThreads(first: 50) { nodes { id isResolved comments(first: 1) { nodes { body path } } } } } } }' -
解决线程:使用mutation:
resolveReviewThreadbashgh api graphql -f query=' mutation { resolveReviewThread(input: {threadId: "PRRT_xxx"}) { thread { isResolved } } }' -
一次解决多个线程:bash
gh api graphql -f query=' mutation { t1: resolveReviewThread(input: {threadId: "PRRT_xxx"}) { thread { isResolved } } t2: resolveReviewThread(input: {threadId: "PRRT_yyy"}) { thread { isResolved } } }'
线程ID以开头,可以在GraphQL查询响应中找到。
PRRT_注意:一旦GitHub MCP服务器添加了对回复PR评审评论和解决线程的内置支持,就可以移除这个skill。
参考:
https://github.com/github/github-mcp-server/issues/1323
https://github.com/github/github-mcp-server/issues/1768