‹ 首页

pr-review-comments

@giuseppe-trisciuoglio · 收录于 1 周前

Posts review findings from a JSON file as inline comments on a GitHub Pull Request, attaching each comment to its file and line. Use when you have a list/JSON of review findings (each with a file path, line number, and a message such as summary/failure_scenario) and want them published on a PR as inline review comments. Triggers include "post these review comments on the PR", "associate comments to files in the PR", "publish review findings to PR

适合你,如果你有审查结果JSON,想直接贴在PR对应行上

/ 下载安装
pr-review-comments.skill双击,或拖进 Claude 桌面版 / Cowork,即完成安装↓ .skill↓ .zip
用别的 agent?下载 .zip 解压,把文件夹放进它的技能目录
Claude Code~/.claude/skills/(项目级 .claude/skills/)
Codex CLI~/.codex/skills/
Cursor自动读取上面两处目录
其他工具见其文档的「skills」目录;两个下载是同一份文件,只是名字不同
/ 通过 npx 安装 校验哈希
npx oh-my-skill add giuseppe-trisciuoglio/developer-kit/pr-review-comments
/ 通过 bash 安装
curl -fsSL https://oh-my-skill.com/install.sh | bash -s -- giuseppe-trisciuoglio/developer-kit/pr-review-comments
/ 已经装过?验证本机副本,不用重装
npx oh-my-skill verify giuseppe-trisciuoglio/developer-kit/pr-review-comments
安装目标可用 --agent / --scope 或 --to 明确指定;省略时只会在唯一已存在的 agent 目录上自动选择,零命中或多命中会停止并提示。content_hash 缺失或不一致均拒装。
303GitHub stars
~954最小装载
~3.2K含声明引用
~3.2K文本包总量
镜像托管

怎么用

技能原文 SKILL.md作者撰写 · MIT · 306f428

PR Review Comments

Publish a JSON array of review findings as inline comments on a GitHub Pull Request, each anchored to its file and line. Uses the GitHub API through the authenticated gh CLI, so no token handling is needed.

Prerequisites
  • gh CLI installed and authenticated (gh auth status). The script auto-detects the repo with gh repo view; pass --repo OWNER/REPO to override.
  • The PR number to comment on.
  • A JSON file: an array of objects. Required keys per object: file, line. Message comes from summary and/or failure_scenario (combined into the body), or an explicit body. See [references/json-schema.md](references/json-schema.md) for the full schema and a sample.
Key constraint: only diff lines are commentable

GitHub only accepts an inline comment if the target line is part of the PR's diff. line is the line number in the new file (use side: "LEFT" for removed lines). The script fetches the PR diff, validates every finding against the actual hunks, and skips any whose line is outside the diff — reporting them at the end so nothing is lost silently. There is no way to attach a line comment to an unchanged, undiffed line.

Workflow
  1. Confirm the JSON path and the PR number. If the repo isn't obvious, run gh repo view.
  2. Dry-run first to see what will be posted and what gets skipped: ```bash scripts/post_pr_comments.py --pr <N> --json <path> --dry-run ```
  3. Review the "Postable" / "Skipped" counts with the user. If lines were skipped because the diff moved, the line numbers in the JSON may be stale — reconcile before posting.
  4. Post for real, choosing the mode (see below): ```bash # Grouped (default): one PR review bundling all comments scripts/post_pr_comments.py --pr <N> --json <path> --event COMMENT

# Individual: one separate inline comment per finding scripts/post_pr_comments.py --pr <N> --json <path> --mode individual ```

  1. Report back the created review/comment URLs and the list of any skipped findings.
Choosing the mode

| Mode | Endpoint | Use when | |------|----------|----------| | grouped (default) | POST /pulls/{n}/reviews | Publishing a set of findings as one review. One notification; can set --event APPROVE \| REQUEST_CHANGES \| COMMENT. | | individual | POST /pulls/{n}/comments | Adding standalone comments incrementally, or when each finding should be its own thread/notification. |

Default to grouped with --event COMMENT unless the user wants a verdict or separate threads.

Options reference
--pr N              PR number (required)
--json PATH         JSON array of findings (required)
--repo OWNER/REPO   Override auto-detected repo
--mode grouped|individual   Default: grouped
--event COMMENT|APPROVE|REQUEST_CHANGES   Grouped-mode verdict (default COMMENT)
--review-body TEXT  Top-level summary body for the grouped review
--commit SHA        Commit to anchor to (default: PR head SHA)
--dry-run           Validate and print payloads without posting
Notes
  • Multi-line range comments: include start_line (and optional start_side) in the JSON object alongside line; the script passes them through.
  • Always --dry-run before a real post on an unfamiliar PR — stale line numbers are the most common failure and the dry-run surfaces them as "skipped" without side effects.
  • The script is the reliable path; don't hand-roll gh api calls for this — it handles diff validation, repo/commit detection, and body assembly consistently.
按 MIT 许可原样转载,未经改动 · 在 GitHub 查看 →

评论

登录即可评论;带「已验证安装」的,是发布者名下有本店的安装或持有记录。