GitHub Actions SHA Rerun Debt Audit
Use this skill to detect commits that trigger repeated GitHub Actions reruns and failed outcomes across multiple workflows.
What this skill does
- - Reads GitHub Actions run JSON exports
- Correlates attempt history by run id and latest outcome per run
- Aggregates rerun debt by repository + commit SHA
- Scores risk using rerun rate, failed-run count, workflow spread, and wasted rerun minutes
- Emits severity (
ok, warn, critical) for CI gates
Inputs
Optional:
- -
RUN_GLOB (default: artifacts/github-actions/*.json) - INLINECODE5 (default:
20) - INLINECODE7 (
text or json, default: text) - INLINECODE11 (minimum runs per SHA, default:
3) - INLINECODE13 (0..1, default:
0.25) - INLINECODE15 (0..1, default:
0.45) - INLINECODE17 (default:
2) - INLINECODE19 (default:
4) - INLINECODE21 (default:
25) - INLINECODE23 (default:
75) - INLINECODE25 (distinct workflows affected, default:
2) - INLINECODE27 (default:
4) - INLINECODE29 /
WORKFLOW_EXCLUDE (regex, optional) - INLINECODE31 /
BRANCH_EXCLUDE (regex, optional) - INLINECODE33 /
EVENT_EXCLUDE (regex, optional) - INLINECODE35 /
REPO_EXCLUDE (regex, optional) - INLINECODE37 /
HEAD_SHA_EXCLUDE (regex, optional) - INLINECODE39 (comma-separated, default:
failure,cancelled,timed_out,startup_failure,action_required) - INLINECODE41 (
0 or 1, default: 0)
Collect run JSON
CODEBLOCK0
Run
Text report:
CODEBLOCK1
JSON output + fail gate:
CODEBLOCK2
Run against bundled fixtures:
CODEBLOCK3
Output contract
- - Exit
0 in report mode (default) - Exit
1 when FAIL_ON_CRITICAL=1 and one or more SHA groups are critical - Text mode prints summary + ranked SHA risk groups
- JSON mode prints summary + ranked groups + critical groups
GitHub Actions SHA 重跑债务审计
使用此技能检测在多个工作流中触发重复 GitHub Actions 重跑和失败结果的提交。
该技能的功能
- - 读取 GitHub Actions 运行 JSON 导出文件
- 通过运行 ID 和每次运行的最新结果关联尝试历史
- 按仓库 + 提交 SHA 聚合重跑债务
- 使用重跑率、失败运行次数、工作流分布和浪费的重跑分钟数进行风险评分
- 为 CI 门禁输出严重级别(ok、warn、critical)
输入参数
可选参数:
- - RUNGLOB(默认值:artifacts/github-actions/*.json)
- TOPN(默认值:20)
- OUTPUTFORMAT(text 或 json,默认值:text)
- MINRUNS(每个 SHA 的最小运行次数,默认值:3)
- WARNRERUNRATE(0..1,默认值:0.25)
- CRITICALRERUNRATE(0..1,默认值:0.45)
- WARNFAILEDRUNS(默认值:2)
- CRITICALFAILEDRUNS(默认值:4)
- WARNWASTEDMINUTES(默认值:25)
- CRITICALWASTEDMINUTES(默认值:75)
- WARNWORKFLOWS(受影响的不同工作流数,默认值:2)
- CRITICALWORKFLOWS(默认值:4)
- WORKFLOWMATCH / WORKFLOWEXCLUDE(正则表达式,可选)
- BRANCHMATCH / BRANCHEXCLUDE(正则表达式,可选)
- EVENTMATCH / EVENTEXCLUDE(正则表达式,可选)
- REPOMATCH / REPOEXCLUDE(正则表达式,可选)
- HEADSHAMATCH / HEADSHAEXCLUDE(正则表达式,可选)
- FAILURECONCLUSIONS(逗号分隔,默认值:failure,cancelled,timedout,startupfailure,actionrequired)
- FAILONCRITICAL(0 或 1,默认值:0)
收集运行 JSON
bash
gh run view --attempt \
--json databaseId,runAttempt,workflowName,event,headBranch,headSha,conclusion,createdAt,updatedAt,runStartedAt,url,repository \
> artifacts/github-actions/run--attempt-.json
运行
文本报告:
bash
RUN_GLOB=artifacts/github-actions/*.json \
bash skills/github-actions-sha-rerun-debt-audit/scripts/sha-rerun-debt-audit.sh
JSON 输出 + 失败门禁:
bash
RUN_GLOB=artifacts/github-actions/*.json \
OUTPUT_FORMAT=json \
FAILONCRITICAL=1 \
bash skills/github-actions-sha-rerun-debt-audit/scripts/sha-rerun-debt-audit.sh
针对捆绑的测试数据运行:
bash
RUN_GLOB=skills/github-actions-sha-rerun-debt-audit/fixtures/*.json \
bash skills/github-actions-sha-rerun-debt-audit/scripts/sha-rerun-debt-audit.sh
输出约定
- - 报告模式下退出码为 0(默认)
- 当 FAILONCRITICAL=1 且一个或多个 SHA 组为严重级别时,退出码为 1
- 文本模式打印摘要 + 排序后的 SHA 风险组
- JSON 模式打印摘要 + 排序后的组 + 严重级别组