跳到正文
Skillpedia
部署与云(DevOps)8.0k · #12681

github-triage

它能做什么

梳理 GitHub 代码仓库中未关闭的问题和拉取请求,找出已解决的项目,并把问题与对应的修复关联起来。适用于希望清理问题积压的维护者。

适用场景

  • ✓维护者想整理代码仓库中未关闭的问题和拉取请求的时候。
  • ✓维护者发现已有修复却没有关闭对应问题的时候。
  • ✓维护者有大量待审查或待合并的拉取请求,并希望处理它们的时候。

技能链接

https://github.com/trailofbits/skills/blob/main/plugins/github-triage/skills/github-triage/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/trailofbits/skills/blob/main/plugins/github-triage/skills/github-triage/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“请梳理我仓库中未关闭的问题和拉取请求,告诉我哪些可以关闭或合并。”

每周 5 个新技能,1 分钟读完。

工作原理

该技能使用 gh 工具检查未关闭的项目,找出已经修复的问题,并把问题与待处理的修复关联起来。它会在本地为各项分配优先级和规模估算,并把每次合并或关闭的建议提交给你批准。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

GitHub Triage

Triage a repository's open GitHub issues and pull requests. Optionally clear ready PRs first (merge passing bot PRs and maintainer-approved PRs, review never-reviewed ones), then close issues that are already resolved (with a comment citing the PR or commit that resolved them), make sure issues and the pending PRs that fix them reference each other, and assign a local-only priority and change-size estimate to every issue that is still outstanding.

When to Use

  • When the user runs /github-triage to groom or review a repository's open issues and pull requests.
  • When an issue backlog has drifted: resolved work left open, fixes landed without closing their issues, or PRs in flight that never linked their issue.
  • When ready PRs have piled up (passing dependency bumps, approved-and-green PRs) or PRs are sitting unreviewed.

When NOT to Use

  • Do not invoke automatically. This skill performs irreversible GitHub writes (merging PRs, closing issues, posting comments) and runs only on explicit invocation.
  • Do not use to apply priority/effort labels on GitHub. Priority and size are presented locally only and are never posted (see Safety Rules).
  • Do not use as a substitute for a human's final merge decision — every merge is proposed for explicit approval, never performed autonomously.

Core Principles

  1. Writes are gated. Compute the full triage first, present every proposed write — merges included — for review, and execute nothing until the user approves.
  2. Evidence before closing. Never close an issue without a concrete, cited reason (a merged PR or a commit on the default branch). When evidence is weak or ambiguous, leave the issue outstanding and flag it for review.
  3. Priority and size stay local. They are an internal planning aid for the user, never written to GitHub.

Workflow

Phase 0: Select the target repository

gh auth status                       # confirm gh is authenticated
git rev-parse --is-inside-work-tree  # is PWD a git repository?
git remote -v                        # enumerate remotes

Determine the set of distinct GitHub-hosted repositories among the remotes. A remote is GitHub-hosted when its URL host is github.com, in any of these forms:

  • https://github.com/OWNER/REPO(.git)
  • git@github.com:OWNER/REPO(.git)
  • ssh://git@github.com/OWNER/REPO(.git)

Normalize each to OWNER/REPO and de-duplicate (a fork setup may have origin and upstream pointing at different GitHub repos; multiple remotes pointing at the same OWNER/REPO count once).

Selection rule:

Situation Action
Exactly one distinct GitHub repo Use it as the default — do not prompt.
Not a git repo, or zero GitHub remotes Ask the user for the OWNER/REPO to triage.
More than one distinct GitHub repo Use AskUserQuestion to let the user pick which OWNER/REPO.

GitHub Enterprise hosts cannot be auto-detected reliably. If the user works on a GHE instance, ask for OWNER/REPO and have them set GH_HOST / use gh's configured host. Confirm the resolved repo back to the user before continuing.

Store the result as REPO="OWNER/REPO" and pass -R "$REPO" to every gh call. Validate it against ^[A-Za-z0-9._-]+/[A-Za-z0-9._-]+$ before use, so a malformed or hostile remote URL never flows into a command.

Phase 1: Gather issues and context

# Open issues (gh issue list excludes PRs by default)
gh issue list -R "$REPO" --state open --limit 1000 \
  --json number,title,body,labels,assignees,comments,reactionGroups,createdAt,updatedAt,url

# Open PRs — candidates for "pending fix" (issue phase) and PR triage (Phase 2)
gh pr list -R "$REPO" --state open --limit 1000 \
  --json number,title,body,author,isDraft,reviewDecision,latestReviews,\
mergeable,mergeStateStatus,statusCheckRollup,labels,createdAt,headRefName,url,closingIssuesReferences

# Recently merged PRs — candidates for "already resolved"
gh pr list -R "$REPO" --state merged --limit 300 \
  --json number,title,body,mergedAt,url,closingIssuesReferences

closingIssuesReferences lists the issues a PR is linked to close — populated by any of GitHub's closing keywords (close/closes/closed, fix/fixes/fixed, resolve/resolves/resolved) in the PR body, or by a manual UI link. It is the strongest available signal. For issues it does not cover, also search commit messages on the default branch. Re

常见问题

它会自行合并或关闭内容吗?

不会。合并和关闭都只是建议,需要你明确批准,它不会自行执行。

优先级标签会发布到 GitHub 上吗?

不会。优先级和规模估算只在本地显示,从不发布。

它会自动运行吗?

不会。它只在你调用时运行,因为它会对 GitHub 做出不可撤销的更改。

详情

作者的原始描述

Triages a repository's open GitHub issues and pull requests via the gh CLI. Optionally reviews and merges ready PRs — incrementally merging passing automated/bot PRs and maintainer-approved ones, and spawning review subagents for never-reviewed ones — then closes already-resolved issues with comments citing the resolving PR or commit, cross-links issues with their pending fix PRs, and assigns local-only priority and change-size estimates for everything outstanding. Use when triaging, grooming, or reviewing a repository's open issues and PRs.

repo: trailofbits/skills

热度

GitHub 星标
8.0k
排名
#12681
许可证
CC-BY-SA-4.0
更新时间
2026/11/2

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能