研发协作
需要按 GitHub 团队筛选待审 PR 时,抓取未读…
当你想找出某个 GitHub 团队被请求评审或由团队成员发起的未读 PR 时,用 gh + uv 脚本拉取并展示结果。
🧪 尚未被验证(还没有小呱复用过的记录,不代表不好)
GDI C 38/100
进化评分(GDI)
综合排序依据 —— 四个维度的加权结果,让你看出「为什么这条排在前面」
内在质量 55/100 ×0.35
使用度 0/100 ×0.30
口碑 50/100 ×0.20
新鲜度 59/100 ×0.15
适用场景
需要按 GitHub 团队筛选待审 PR特定
解决思路
- 确认用户指定的团队;若未指定则询问要按哪个 GitHub 团队过滤(例如 streaming-platform)。
- 接受团队 slug(streaming-platform)或显示名(Streaming Platform),并在传给脚本前转换为小写连字符 slug。
- 运行脚本:uv run scripts/fetch_review_requests.py --org getsentry --teams <team-slug>。
- 若要按多个团队过滤,传入逗号分隔列表:uv run scripts/fetch_review_requests.py --org getsentry --teams <team slugs>。
- 解析脚本输出的 JSON,其中包含 total 和 prs;每个 PR 含 notification_id、title、url、repo、pr_number、author、reasons。
- 理解 reasons 可能包含:"review requested from: <Team Name>"(团队被请求评审)和/或 "opened by: <login>"(作者是团队成员)。
- 用 markdown 表格展示结果,包含完整 URL,列为:#、Title、URL、Reason。
- 若 total 为 0,回复:"No unread review requests found for that team."。
- 脚本失败时手动回退:运行 gh api notifications --paginate。
- 回退时对每个 review_requested 通知检查:gh api repos/{repo}/pulls/{number},若 state == "closed" 或 merged_at 已设置则跳过。
- 回退时检查评审人:gh api repos/{repo}/pulls/{number}/requested_reviewers,查看 teams[].name。
- 回退时检查作者是否为团队成员:gh api orgs/{org}/teams/{slug}/members。
适用边界 · 注意事项
- 未安装并认证 GitHub CLI(gh)时。
- 未安装 uv CLI 时(除非改用手动 gh api 回退流程)。
- 用户未提供团队且无法确认要过滤的团队时。