address-pr-comments

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

PR Comment Handler

PR评论处理工具

Guide to find the open PR for the current branch and address its comments with gh CLI. Run all
gh
commands with elevated network access.
本指南介绍如何使用gh CLI找到当前分支的公开PR并处理其中的评论。所有
gh
命令都需要以提升的网络权限运行。

Preflight

前置准备

  1. Create a structured task list of the following steps
  2. Inform the user of what you are doing
You should endeavor to run this entire workflow autonomously, only engaging the user if issues arise or uncertain how to best proceed.
  1. 创建包含以下步骤的结构化任务列表
  2. 告知用户你正在执行的操作
你应尽可能自主完成整个工作流程,仅在出现问题或不确定如何继续时才与用户互动。

Step 1: Inspect comments needing attention

步骤1:检查需要处理的评论

  • Run
    <path-to-skill>/scripts/fetch_comments.py
    which will print out all the comments and review threads on the PR
  • 运行
    <path-to-skill>/scripts/fetch_comments.py
    ,该脚本将打印出PR上的所有评论和评审线程

Step 2: Enumarate issues identified in comments and review threads

步骤2:列举评论和评审线程中发现的问题

  • Number all the review threads and comments
  • Provide a short summary of each "issue candidate," including any suggested fixes from the reviewer
  • 为所有评审线程和评论编号
  • 为每个“问题候选项”提供简短摘要,包括评审者提出的任何修复建议

Step 3: Identify actionable issues to address

步骤3:确定可处理的问题

  • For each issue candidate, analyze against the codebase to distinguish actionable items from false positives or comments that do not require code changes (for example, questions, suggestions, or style comments).
  • Verify each finding against current code. Plan to fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate.
  • 针对每个问题候选项,对照代码库进行分析,区分可执行项与误报或无需修改代码的评论(例如疑问、建议或风格类评论)。
  • 对照当前代码验证每个发现。仅计划修复仍然有效的问题,跳过其余问题并给出简短理由,保持修改最小化并进行验证。

Step 4: Apply fixes to all actionable issues & resolve/address comments

步骤4:修复所有可处理的问题并解决/回复评论

  • Use TDD when possible: write a failing test that captures the issue, then apply the fix to make the test pass.
  • Resolve or reply to those threads in the GitHub UI as you address them. For comments not addressed, reply to reviewers with your reasoning and ask for any clarification if needed.
  • 尽可能使用TDD:编写一个能复现问题的失败测试,然后应用修复使测试通过。
  • 在GitHub界面中解决或回复这些线程。对于未处理的评论,回复评审者说明你的理由,并在需要时请求澄清。

Step 5: Run checks, commit and push changes

步骤5:运行检查、提交并推送更改

  • After applying fixes, run the relevant tests and checks locally to confirm the issue is resolved.
  • Summarize the changes made, commit with a clear message referencing the PR and issue numbers, and push the changes to the PR branch.
  • 应用修复后,在本地运行相关测试和检查以确认问题已解决。
  • 总结所做的更改,使用引用PR和问题编号的清晰消息提交,并将更改推送到PR分支。

Step 6: Monitor CI Actions and address any new failures

步骤6:监控CI操作并处理任何新的失败

  • After pushing, monitor the PR's CI checks for any new failures that may arise from the changes.
  • If new failures occur, use the
    gh-fix-ci
    skill to analyze the CI logs, identify the root cause, and apply necessary fixes.
  • 推送后,监控PR的CI检查是否出现任何由更改引发的新失败。
  • 如果出现新失败,使用
    gh-fix-ci
    技能分析CI日志,确定根本原因并应用必要的修复。

Final verification and summary

最终验证与总结

  • Double check that all comments have been addressed and resolved in the GitHub UI.
  • Summarize the outcome of the comment addressing process, including any remaining open questions or follow-ups needed with reviewers.
Notes:
  • If gh hits auth/rate issues mid-run, prompt the user to re-authenticate with
    gh auth login
    , then retry.
  • If sandboxing blocks
    gh auth status
    , rerun it with
    sandbox_permissions=require_escalated
    .
  • 再次检查GitHub界面中所有评论是否已处理并解决。
  • 总结评论处理过程的结果,包括任何尚未解决的问题或需要与评审者跟进的事项。
注意:
  • 如果gh在运行过程中遇到身份验证/速率限制问题,提示用户使用
    gh auth login
    重新验证,然后重试。
  • 如果沙箱阻止
    gh auth status
    ,使用
    sandbox_permissions=require_escalated
    重新运行。