GitHub Actions Rerun Waste Audit
Use this skill to measure CI waste caused by reruns and repeated attempts in GitHub Actions.
What this skill does
- - Reads one or more run JSON exports (
gh run view --json ...) - Groups attempts by repository + workflow + branch + commit + job name
- Estimates rerun waste from all attempts except the latest attempt in each group
- Flags severity using waste-minute thresholds
- Emits text or JSON output for triage dashboards and CI quality reviews
Inputs
Optional:
- -
RUN_GLOB (default: artifacts/github-actions/*.json) - INLINECODE3 (default:
20) - INLINECODE5 (
text or json, default: text) - INLINECODE9 (default:
10) - INLINECODE11 (default:
30) - INLINECODE13 (
0 or 1, default: 0) - INLINECODE17 ,
WORKFLOW_EXCLUDE (regex, optional) - INLINECODE19 ,
JOB_EXCLUDE (regex, optional) - INLINECODE21 ,
REPO_EXCLUDE (regex, optional) - INLINECODE23 ,
BRANCH_EXCLUDE (regex, optional)
Collect run JSON
CODEBLOCK0
If runAttempt is missing, this skill also checks run_attempt and job-level attempt.
Run
Text report:
CODEBLOCK1
JSON output + fail gate:
CODEBLOCK2
Repo/workflow filter:
CODEBLOCK3
Run with bundled fixtures:
CODEBLOCK4
Output contract
- - Exit
0 in reporting mode - Exit
1 when FAIL_ON_CRITICAL=1 and at least one critical group exists - Text output includes summary, thresholds, and top rerun-waste groups
- JSON output includes
summary, ranked groups, and INLINECODE33
GitHub Actions 重试浪费审计
使用此技能来评估 GitHub Actions 中因重试和重复尝试导致的 CI 浪费。
此技能的功能
- - 读取一个或多个运行 JSON 导出文件(gh run view --json ...)
- 按仓库 + 工作流 + 分支 + 提交 + 任务名称对尝试进行分组
- 估算每个分组中除最新尝试外的所有尝试造成的重试浪费
- 使用浪费分钟数阈值标记严重程度
- 输出文本或 JSON 格式,用于分类仪表板和 CI 质量审查
输入参数
可选参数:
- - RUNGLOB(默认值:artifacts/github-actions/*.json)
- TOPN(默认值:20)
- OUTPUTFORMAT(text 或 json,默认值:text)
- WARNMINUTES(默认值:10)
- CRITICALMINUTES(默认值:30)
- FAILONCRITICAL(0 或 1,默认值:0)
- WORKFLOWMATCH、WORKFLOWEXCLUDE(正则表达式,可选)
- JOBMATCH、JOBEXCLUDE(正则表达式,可选)
- REPOMATCH、REPOEXCLUDE(正则表达式,可选)
- BRANCHMATCH、BRANCH_EXCLUDE(正则表达式,可选)
收集运行 JSON
bash
gh run view --json databaseId,workflowName,headBranch,headSha,runAttempt,url,repository,jobs \
> artifacts/github-actions/run-.json
如果缺少 runAttempt,此技能也会检查 run_attempt 和任务级别的 attempt。
运行
文本报告:
bash
RUN_GLOB=artifacts/github-actions/*.json \
WARN_MINUTES=8 \
CRITICAL_MINUTES=20 \
bash skills/github-actions-rerun-waste-audit/scripts/rerun-waste-audit.sh
JSON 输出 + 失败门控:
bash
RUN_GLOB=artifacts/github-actions/*.json \
OUTPUT_FORMAT=json \
FAILONCRITICAL=1 \
bash skills/github-actions-rerun-waste-audit/scripts/rerun-waste-audit.sh
仓库/工作流过滤:
bash
RUN_GLOB=artifacts/github-actions/*.json \
REPO_MATCH=^flowcreatebot/ \
WORKFLOW_MATCH=(CI|Build) \
bash skills/github-actions-rerun-waste-audit/scripts/rerun-waste-audit.sh
使用捆绑的测试数据运行:
bash
RUN_GLOB=skills/github-actions-rerun-waste-audit/fixtures/*.json \
bash skills/github-actions-rerun-waste-audit/scripts/rerun-waste-audit.sh
输出约定
- - 报告模式下退出码为 0
- 当 FAILONCRITICAL=1 且存在至少一个严重分组时,退出码为 1
- 文本输出包含摘要、阈值和重试浪费最多的分组
- JSON 输出包含 summary、排序后的 groups 和 critical_groups