check-pr-approvals — independently scanned and version-tracked by SaferSkills.
SaferSkills independently audited check-pr-approvals (Agent Skill) and scored it 100/100 (green). The audit ran 55 deterministic rules across Security, Supply Chain, Maintenance, Transparency, and Community; it found 0 high-severity and 0 lower-severity findings. The full rule-by-rule trace and per-finding evidence are below. Free, methodology-open.
Findings & checks · 0 flagged
Every scanned point with the score it earned and what moved between them.
First recorded scan — no prior version to compare against.
The primary manifest — the file an agent reads to learn what this artifact does.
掃描 {config: github.org} org(fallback: your-org)下指定使用者的 open PR,偵測 rebase、CI、review comments、approval / stale approval,並用 shared PR state vocabulary 做分類後等待使用者選擇下一步。
核心邊界:本 skill 只偵測、分類、呈報與在使用者選擇後通知 reviewer;不自動修正 CI failure、review comments 或 rebase conflict。需修正的 PR 交給 engineering。
讀取 workspace config(見 references/workspace-config-reader.md),需要:
github.orgslack.channels.ai_notifications若使用者沒有指定 author,先執行:
MY_USER="$(gh api user --jq '.login')"Script 路徑相對於本 skill 目錄。執行前確認有 +x 權限。
| Script | 用途 | Output contract |
|---|---|---|
scripts/fetch-user-open-prs.sh | 搜尋 author open PR,含 base/head/labels | PR JSON array |
scripts/rebase-pr-branch.sh | 批次 rebase PR branches | 加上 rebase_status |
scripts/fetch-pr-review-comments.sh | 批次取得未回覆 actionable comments | 加上 actionable_comments |
scripts/check-pr-approval-status.sh | 批次檢查 approvals / stale | 加上 approval fields |
Script 是 deterministic source;不要在入口重寫其內部 API / stale / bot filter 邏輯。PR type、mergeability、base_freshness、awaiting_re_review / mergeable_ready 語義以 shared PR state contract 為準。本 skill 只能偵測與轉述 shared state,不得把 bucket 名稱包裝成 author-side completion / release authority。
| 何時讀 | Reference | 用途 |
|---|---|---|
| 產出分類報告、加 label、送 Slack、處理需修正 PR 時 | references/check-pr-approvals-reporting.md | report table、Slack wording、label fallback、JIRA remediation routing |
| 判讀 approval / stale semantics 前 | ../references/stale-approval-detection.md | stale approval 權威定義 |
| 掃到 merged PR 時 | ../references/feature-branch-pr-gate.md | Feature Branch PR Gate |
| Slack message 送出前 | ../references/workspace-language-policy.md | language gate |
| 收尾前 | ../references/post-task-reflection-checkpoint.md | post-task reflection |
"$SKILL_DIR/scripts/fetch-user-open-prs.sh" --author "$MY_USER"若結果為 [],回報目前沒有 open PR,流程結束。
"$SKILL_DIR/scripts/fetch-user-open-prs.sh" --author "$MY_USER" \
| "$SKILL_DIR/scripts/rebase-pr-branch.sh" --work-dir "{base_dir}"rebase_status=conflict 的 PR 直接歸類為 🔧 需先修正,不嘗試自動解衝突。
對 rebase 成功或 skipped 的 PR 查。CI / mergeability / base freshness vocabulary 以 ../references/pr-state-contract.md 與 shared PR state scripts 為準;本 skill 不再依賴 舊的 shared reference PR status helper,也不自行重建 PR readiness schema。
Classification(先看 shared PR state,再看傳統 bucket):
codecov/patch 與 codecov/patch/* fail 一律等同 CI fail。
echo "$ci_passed_prs" \
| "$SKILL_DIR/scripts/fetch-pr-review-comments.sh" --author "$MY_USER"有未回覆 actionable comments 的 PR 歸類為 🔧 需先修正。Code review bots 的建議視為 actionable;非 code review bot 通知由 script 過濾。
先讀 ../references/stale-approval-detection.md,再跑:
echo "$review_comment_checked_prs" \
| "$SKILL_DIR/scripts/check-pr-approval-status.sh" --threshold "$APPROVAL_THRESHOLD"Valid approval = APPROVED 且非 stale。Stale approval 不算達標。
| 分類 | 條件 | 下一步 |
|---|---|---|
| 🟢 可催 review | CI pass + 無 actionable comments + rebase 成功/可接受 + valid approvals 不足;包含 shared classifier 判定的 AWAITING_RE_REVIEW | 可讓使用者選擇通知 |
| 🔧 需先修正 | CI fail / rebase conflict / actionable comments | 萃取 ticket key,提示走 engineering |
| ✅ 已達標 | valid approvals >= threshold | 不加 label、不通知;這只代表 approval threshold 達標,不等於 release completed |
若 PR reviewDecision=CHANGES_REQUESTED,先用 scripts/pr-review-state-classifier.sh 或等價 thread-aware evidence 判斷。AWAITING_RE_REVIEW 代表作者已處理且需要 reviewer 重新 review;不得把它列為 🔧,也不得將 JIRA 轉回 IN DEVELOPMENT。
shared PR state 若是 unsupported_mutation、blocked_conflict、或 base_freshness=stale_downstream, 不能用「可催 review」包裝;要明確落在需修正 / 需 rebase 的 bucket。
🔧 PR 必須從 branch name 或 title 萃取 ticket key(pattern: [A-Z]+-\d+);萃取不到就標「無對應 ticket」。有 ticket key 且 JIRA 在 CODE REVIEW 時,依 reporting reference 回轉 IN DEVELOPMENT 並留言。
讀 references/check-pr-approvals-reporting.md 產出使用者報告。報告後必須等待使用者輸入要通知的 🟢 PR 編號,例如 1,2、all、none。
不可讓使用者選 🔧 或 ✅ PR 送 review reminder。未得到選擇前,不加 label、不送 Slack。
只處理使用者選中的 🟢 PR:
bash scripts/validate-language-policy.sh --blocking --mode artifact <check-pr-approvals-slack.md>如果掃描過程發現 merged PR:
../references/feature-branch-pr-gate.md 並執行 gate。gh pr view --json reviews 取代 bundled approval script。gh pr checks --json 取代 bundled REST-backed status script。~30 seconds. Free. No account. Every finding cites a rule and a line of evidence.