mcpField
G
github-pr-workflow

github-pr-workflow

github.com/ypares开发3069 次安装1 天前更新
代码仓库

关于 github-pr-workflow

用于查看 GitHub PR 并处理审查反馈的技能。`gh-pr-info` 脚本汇总 PR 状态、CI 检查及未解决的审查评论,包括行内讨论。

主要功能

  1. 01汇总 PR 状态与 CI 检查
  2. 02查找未解决的行内审查评论
  3. 03过滤已解决、隐藏或已驳回的反馈
  4. 04从 git remote 识别仓库
  5. 05参考 GitHub API 端点

适用场景

  1. 01合并前检查待处理反馈
  2. 02查看 PR 的 CI 与审查状态
  3. 03查找 `gh pr view --comments` 未显示的行内评论

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/ypares/agent-skills --skill github-pr-workflow

安装后在 Claude Code 中输入/github-pr-workflow确认已加载。

附带文件scripts/gh-pr-info

详细介绍

GitHub PR 工作流

核心概念

评论类型

GitHub PR 有两种不同类型的评论:

  1. PR 级评论 - 关于 PR 的一般讨论(通过 gh pr view --comments 显示)
  2. 代码行内审查评论 - 附加到特定代码行的评论(需要使用 API)

重要:gh pr view --comments 不会显示代码行内审查评论!

脚本

脚本用途
gh-pr-info <PR> [REPO]全面的 PR 信息:摘要、CI 检查、未解决的审查评论和行内评论

脚本会自动从 git 远程仓库检测仓库,也可以将 [REPO] 作为第二个参数传入(格式:owner/repo)。

主要功能:

  • 使用 GitHub 的 GraphQL API,可靠地筛除已解决或已处理的评论
  • 排除已折叠或隐藏的审查讨论串
  • 排除已最小化的评论(标记为垃圾信息、无关内容或已解决)
  • 排除已撤销的审查
  • 仅显示仍需处理的内容

常用命令

# Get complete PR info with UNRESOLVED comments only
gh-pr-info <PR> [REPO]             # ✅ Everything you need: summary, checks, reviews, unresolved comments

# Basic PR info (native gh commands)
gh pr view <PR>                    # Overview
gh pr view <PR> --comments         # PR-level comments only (NOT inline!)
gh pr diff <PR>                    # View the diff

# Reviews (approve/request changes)
gh pr review <PR> --approve
gh pr review <PR> --request-changes --body "Please fix X"
gh pr review <PR> --comment --body "Looks good overall"

# Checks
gh pr checks <PR>                  # CI status
gh run view <RUN_ID> --log-failed  # Failed job logs

API 端点参考

当 gh 命令无法提供所需信息时,请使用 API:

# Inline review comments
gh api repos/OWNER/REPO/pulls/PR/comments

# PR-level comments (issue comments)
gh api repos/OWNER/REPO/issues/PR/comments

# Review submissions
gh api repos/OWNER/REPO/pulls/PR/reviews

# Commits in PR
gh api repos/OWNER/REPO/pulls/PR/commits

# Files changed
gh api repos/OWNER/REPO/pulls/PR/files

工作流:处理审查评论

  1. 获取未解决的评论:gh-pr-info <PR>
  2. 在本地分支中修复问题

评论

支持 Markdown