nemoclaw-maintainer-find-review-pr

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Find PR to Review

查找待评审PR

Search for open PRs labeled
security
+
priority: high
, associate each with its linked issue, detect duplicates (multiple PRs targeting the same issue), and present a clean summary so you can decide what to review or close.
搜索带有
security
priority: high
标签的开放PR,将每个PR与其关联的Issue绑定,检测重复项(多个针对同一Issue的PR),并生成清晰的汇总信息,帮助你决定评审或关闭哪些PR。

Prerequisites

前置条件

  • gh
    (GitHub CLI) must be installed and authenticated.
  • You must be in a GitHub repository (or the user must specify
    OWNER/REPO
    ).
  • 必须安装并认证
    gh
    (GitHub CLI)。
  • 你需要处于某个GitHub仓库中(或者用户必须指定
    OWNER/REPO
    )。

Step 1: Fetch candidate PRs

步骤1:获取候选PR

List all open PRs that carry both the
security
and
priority: high
labels:
bash
gh pr list --label security --label "priority: high" --state open --limit 50 --json number,title,author,headRefName,labels,body,createdAt
If the result is empty, report that there are no matching PRs and stop.
列出所有同时带有
security
priority: high
标签的开放PR:
bash
gh pr list --label security --label "priority: high" --state open --limit 50 --json number,title,author,headRefName,labels,body,createdAt
如果结果为空,报告没有匹配的PR并停止操作。

Step 2: Extract linked issues

步骤2:提取关联Issue

For each PR, parse the body for linked issue references. Look for these patterns (case-insensitive):
  • Fixes #NNN
    ,
    Closes #NNN
    ,
    Resolves #NNN
  • Related Issue
    /
    Linked Issue
    section containing
    #NNN
  • Issue number in the PR title, e.g.
    (#NNN)
    suffix
  • Branch name containing an issue number, e.g.
    fix/something-NNN
Build a mapping:
PR# → [issue numbers]
.
If a PR has no detectable linked issue, mark it as
(no linked issue)
.
针对每个PR,解析其内容以查找关联的Issue引用。查找以下模式(不区分大小写):
  • Fixes #NNN
    Closes #NNN
    Resolves #NNN
  • 包含
    #NNN
    Related Issue
    /
    Linked Issue
    章节
  • PR标题中的Issue编号,例如后缀
    (#NNN)
  • 包含Issue编号的分支名称,例如
    fix/something-NNN
构建映射关系:
PR# → [Issue编号列表]
如果某个PR无法检测到关联Issue,标记为
(no linked issue)

Step 3: Detect duplicates

步骤3:检测重复项

Group PRs by linked issue number. Any issue with two or more open PRs is a duplicate group.
For each duplicate group, fetch a brief summary of each competing PR to help the user decide which to keep:
bash
gh pr view <number> --json number,title,author,createdAt,additions,deletions,reviewDecision,statusCheckRollup --jq '{number,title,author: .author.login,created: .createdAt,additions,deletions,review: .reviewDecision,checks: [.statusCheckRollup[]?.conclusion] | unique}'
按关联的Issue编号对PR进行分组。任何拥有两个或更多开放PR的Issue都属于重复组。
针对每个重复组,获取每个竞争PR的简要摘要,帮助用户决定保留哪一个:
bash
gh pr view <number> --json number,title,author,createdAt,additions,deletions,reviewDecision,statusCheckRollup --jq '{number,title,author: .author.login,created: .createdAt,additions,deletions,review: .reviewDecision,checks: [.statusCheckRollup[]?.conclusion] | unique}'

Step 4: Check for superseded PRs

步骤4:检查被替代的PR

Also flag PRs whose body contains phrases like:
  • follow-up to #NNN
    /
    supersedes #NNN
    /
    replaces #NNN
    /
    folds in #NNN
where
#NNN
is another open PR number in the candidate list. These indicate one PR has absorbed another.
同时标记内容中包含以下短语的PR:
  • follow-up to #NNN
    /
    supersedes #NNN
    /
    replaces #NNN
    /
    folds in #NNN
其中
#NNN
是候选列表中的另一个开放PR编号。这些短语表示一个PR已经整合了另一个PR的内容。

Step 5: Present results

步骤5:展示结果

Duplicates / Superseded

重复项/被替代PR

If duplicates or superseded PRs exist, present them first in a table:
markdown
undefined
如果存在重复PR或被替代PR,首先以表格形式展示:
markdown
undefined

Duplicate PRs (same issue)

重复PR(同一Issue)

IssuePRAuthorTitle+/-Status
#804#1121user1...+50/-10Checks passing
#804#1300user2...+80/-20Checks failing
Recommendation: #1121 is smaller and passing checks — consider closing #1300.

For superseded PRs:

```markdown
IssuePR作者标题+/-状态
#804#1121user1...+50/-10检查通过
#804#1300user2...+80/-20检查失败
建议: #1121改动更小且检查通过——考虑关闭#1300。

对于被替代PR:

```markdown

Superseded PRs

被替代PR

  • #1416 supersedes/folds in #1392 (shell-quote sandboxName) → Consider closing #1392 if #1416 covers its scope.
undefined
  • #1416 替代/整合了 #1392(shell-quote sandboxName) → 如果#1416覆盖了#1392的范围,考虑关闭#1392。
undefined

Clean candidates

无重复候选PR

Present non-duplicate PRs in a table:
markdown
undefined
以表格形式展示无重复的PR:
markdown
undefined

Review candidates (no duplicates)

评审候选(无重复)

PRIssueTitleAuthorAge
#1476#577disable remote uninstall fallbackuser12d
#1121#804Landlock read-only /sandboxuser26d
undefined
PRIssue标题作者时长
#1476#577禁用远程卸载回退user12天
#1121#804Landlock 只读/sandboxuser26天
undefined

Summary line

总结建议

End with a one-line recommendation of which PR to review first, preferring:
  1. Older PRs (waiting longest)
  2. PRs with passing checks
  3. PRs with smaller diff size (easier to review)
最后给出一行关于优先评审哪个PR的建议,优先级如下:
  1. 更早的PR(等待时间最长)
  2. 检查通过的PR
  3. 差异内容更小的PR(更容易评审)

Notes

注意事项

  • Do NOT automatically close any PRs. Only present findings and recommendations.
  • If the user specifies additional filters (e.g., a specific scope label like
    OpenShell
    ), apply them.
  • If the user asks for a different priority label, adjust accordingly.
  • 不要自动关闭任何PR。仅展示发现的问题和建议。
  • 如果用户指定额外的筛选条件(例如,特定范围标签如
    OpenShell
    ),请应用这些条件。
  • 如果用户要求使用不同的优先级标签,请相应调整。