stale-pr-reminder
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseStale PR Reminder
过时PR提醒
Scan repositories for stale Pull Requests and generate a prioritized action report.
扫描仓库中的过时Pull Request,生成带优先级的行动报告。
What is a "Stale PR"?
什么是「过时PR」?
A stale PR is a Pull Request that:
- Has been open for a long time without updates
- Has not received reviewer attention
- Has merge conflicts that haven't been resolved
满足以下特征的Pull Request即为过时PR:
- 已打开很长时间且无更新
- 未得到评审人员关注
- 存在未解决的合并冲突
Staleness Levels
失活等级
| Level | Age | Action |
|---|---|---|
| 🔴 Critical | > 28 days | Close or rework |
| 🟠 Severe | > 14 days no update | Ping author |
| 🟡 Moderate | > 7 days no review | Assign reviewer |
| 🟢 Mild | > 3 days no activity | Monitor |
| ✅ Fresh | < 3 days | No action |
| 等级 | 时长 | 行动 |
|---|---|---|
| 🔴 严重 | 超过28天 | 关闭或返工 |
| 🟠 高危 | 超过14天未更新 | 提醒提交者 |
| 🟡 中等 | 超过7天未评审 | 分配评审人 |
| 🟢 轻微 | 超过3天无活动 | 持续观察 |
| ✅ 正常 | 不足3天 | 无需操作 |
Steps
操作步骤
Step 1: Fetch Open PRs
步骤1:获取打开的PR
Call to retrieve all open PRs:
list_repo_pullsINPUT:
- owner: repository owner
- repo: repository name
- state: "open"
- sort: "created"
- direction: "asc"
- per_page: 100调用接口拉取所有打开状态的PR:
list_repo_pullsINPUT:
- owner: repository owner
- repo: repository name
- state: "open"
- sort: "created"
- direction: "asc"
- per_page: 100Step 2: Get PR Details
步骤2:获取PR详情
For each PR, call :
get_pull_detailEXTRACT:
- number: PR number
- title: PR title
- user.login: author username
- created_at: creation timestamp
- updated_at: last update timestamp
- mergeable: false = has conflicts
- draft: is draft PR为每个PR调用接口:
get_pull_detailEXTRACT:
- number: PR number
- title: PR title
- user.login: author username
- created_at: creation timestamp
- updated_at: last update timestamp
- mergeable: false = has conflicts
- draft: is draft PRStep 3: Get Comments (Optional)
步骤3:获取评论(可选)
Call to check review activity:
list_pull_commentsANALYZE:
- has_reviewer_comments: any comment from non-author
- last_comment_date: most recent comment timestamp调用接口检查评审活动:
list_pull_commentsANALYZE:
- has_reviewer_comments: any comment from non-author
- last_comment_date: most recent comment timestampStep 4: Calculate Staleness
步骤4:计算失活程度
No code execution needed. The AI can parse timestamps directly.
Today's date: 2026-03-17
For each PR:
- Parse (format:
created_at, e.g.,YYYY-MM-DDTHH:MM:SSZ)2026-01-15T10:30:00Z - Parse the same way
updated_at - Calculate days between created_at and today (2026-03-17)
- Calculate days between updated_at and today
- Check if (has conflicts)
mergeable: false - Check if
draft: true
Classification rules:
- : age > 28 days
critical - : age > 14 days AND days_since_update > 14
severe - : age > 7 days AND no reviewer comments
moderate - : age > 3 days AND days_since_update > 3
mild - : otherwise
fresh
无需执行代码,AI可直接解析时间戳。
当前日期: 2026-03-17
对每个PR执行以下计算:
- 解析(格式:
created_at,例如YYYY-MM-DDTHH:MM:SSZ)2026-01-15T10:30:00Z - 用相同方式解析
updated_at - 计算创建时间到当前日期(2026-03-17)的间隔天数
- 计算最后更新时间到当前日期的间隔天数
- 检查是否(存在冲突)
mergeable: false - 检查是否
draft: true
分类规则:
- : 创建时长 > 28天
严重 - : 创建时长 > 14天 且 最后更新间隔 > 14天
高危 - : 创建时长 > 7天 且 无评审人评论
中等 - : 创建时长 > 3天 且 最后更新间隔 > 3天
轻微 - : 其他情况
正常
Step 5: Generate Report
步骤5:生成报告
Create a grouped report with links:
markdown
undefined创建带链接的分组报告:
markdown
undefinedStale PR Report: {owner}/{repo}
过时PR报告: {owner}/{repo}
Critical (> 28 days)
严重 (> 28天)
Severe (> 14 days no update)
高危 (> 14天未更新)
Moderate (> 7 days no review)
中等 (> 7天未评审)
Summary
汇总
- Critical: {count}
- Severe: {count}
- Moderate: {count}
- Fresh: {count}
undefined- 严重: {count}
- 高危: {count}
- 中等: {count}
- 正常: {count}
undefinedUsage Examples
使用示例
Example 1: Basic Check
示例1:基础检查
User: "Check for stale PRs in myrepo"
AI: Scanning myrepo...
Found 10 open PRs:
- 2 Critical (> 28 days)
- 3 Severe (> 14 days)
- 5 Moderate (> 7 days)
[Shows report]用户: "检查myrepo里的过时PR"
AI: 正在扫描myrepo...
共找到10个打开的PR:
- 2个严重级(> 28天)
- 3个高危级(> 14天)
- 5个中等级(> 7天)
[展示报告]Example 2: Check Specific Author
示例2:检查特定提交者的PR
User: "Are there any stale PRs from @alice?"
AI: Found 2 stale PRs from @alice:
- PR #42: 25 days old, needs rebase
- PR #45: 12 days old, waiting for review用户: "@alice有没有提交过时的PR?"
AI: 找到@alice提交的2个过时PR:
- PR #42: 已创建25天,需要变基
- PR #45: 已创建12天,等待评审Notes
注意事项
- Be diplomatic when mentioning stale PRs
- Exclude bot PRs (dependabot, renovate) by default
- Respect "wip", "draft", "on-hold" labels
- 提及过时PR时注意措辞友好
- 默认排除机器人提交的PR(dependabot、renovate等)
- 忽略带有「wip」、「draft」、「on-hold」标签的PR