GitHub Actions Cancel Waste Audit
Use this skill to quantify wasted GitHub Actions runtime from cancelled or timed-out runs so flaky workflow churn gets fixed before it burns CI budget.
What this skill does
- - Reads one or more GitHub Actions run JSON exports (
gh api output) - Estimates wasted runtime minutes per run (
run_started_at/created_at -> updated_at) - Groups waste by repository + workflow + conclusion for fast triage
- Flags warn/critical waste levels using configurable minute thresholds
- Supports text and JSON output for terminal checks or dashboards
Inputs
Optional:
- -
RUN_GLOB (default: artifacts/github-actions-runs/*.json) - INLINECODE6 (default:
20) - INLINECODE8 (
text or json, default: text) - INLINECODE12 (default:
15) - INLINECODE14 (default:
45) - INLINECODE16 (
0 or 1, default: 0) - INLINECODE20 (regex, optional)
- INLINECODE21 (regex, optional)
- INLINECODE22 (regex, optional)
- INLINECODE23 (regex, optional)
- INLINECODE24 (regex, optional)
- INLINECODE25 (regex, optional)
- INLINECODE26 (regex, optional)
- INLINECODE27 (regex, optional)
- INLINECODE28 (regex, optional, default behavior already includes only cancelled/timed_out)
- INLINECODE29 (regex, optional)
Collect run JSON
Single repository:
CODEBLOCK0
Run
Text report:
CODEBLOCK1
JSON output for automation:
CODEBLOCK2
Filter to one repo/workflow family:
CODEBLOCK3
Run with bundled fixtures:
CODEBLOCK4
Output contract
- - Exit
0 in reporting mode (default) - Exit
1 if FAIL_ON_CRITICAL=1 and at least one run has waste at/above INLINECODE33 - In
text mode: prints summary and top waste hotspots - In
json mode: prints summary, grouped stats, and critical run instances
GitHub Actions 取消浪费审计
使用此技能量化因取消或超时运行而浪费的 GitHub Actions 运行时间,以便在消耗 CI 预算之前修复不稳定的工作流问题。
技能功能
- - 读取一个或多个 GitHub Actions 运行 JSON 导出文件(gh api 输出)
- 估算每次运行浪费的运行时间分钟数(runstartedat/createdat -> updatedat)
- 按仓库 + 工作流 + 结论分组统计浪费情况,便于快速分类
- 使用可配置的分钟阈值标记警告/严重浪费级别
- 支持文本和 JSON 输出,适用于终端检查或仪表板
输入参数
可选参数:
- - RUNGLOB(默认值:artifacts/github-actions-runs/*.json)
- TOPN(默认值:20)
- OUTPUTFORMAT(text 或 json,默认值:text)
- WARNWASTEDMINUTES(默认值:15)
- CRITICALWASTEDMINUTES(默认值:45)
- FAILONCRITICAL(0 或 1,默认值:0)
- REPOMATCH(正则表达式,可选)
- REPOEXCLUDE(正则表达式,可选)
- WORKFLOWMATCH(正则表达式,可选)
- WORKFLOWEXCLUDE(正则表达式,可选)
- BRANCHMATCH(正则表达式,可选)
- BRANCHEXCLUDE(正则表达式,可选)
- ACTORMATCH(正则表达式,可选)
- ACTOREXCLUDE(正则表达式,可选)
- CONCLUSIONMATCH(正则表达式,可选,默认行为已包含仅取消/超时)
- CONCLUSION_EXCLUDE(正则表达式,可选)
收集运行 JSON
单个仓库:
bash
gh api repos/<所有者>/<仓库>/actions/runs --paginate \
> artifacts/github-actions-runs/<所有者>-<仓库>.json
运行
文本报告:
bash
RUN_GLOB=artifacts/github-actions-runs/*.json \
WARNWASTEDMINUTES=20 \
CRITICALWASTEDMINUTES=60 \
bash skills/github-actions-cancel-waste-audit/scripts/cancel-waste-audit.sh
用于自动化的 JSON 输出:
bash
RUN_GLOB=artifacts/github-actions-runs/*.json \
OUTPUT_FORMAT=json \
FAILONCRITICAL=1 \
bash skills/github-actions-cancel-waste-audit/scripts/cancel-waste-audit.sh
筛选到单个仓库/工作流系列:
bash
RUN_GLOB=artifacts/github-actions-runs/*.json \
REPO_MATCH=^flowcreatebot/ \
WORKFLOW_MATCH=(test|build) \
BRANCH_MATCH=^(main|release) \
bash skills/github-actions-cancel-waste-audit/scripts/cancel-waste-audit.sh
使用捆绑的测试数据运行:
bash
RUN_GLOB=skills/github-actions-cancel-waste-audit/fixtures/*.json \
bash skills/github-actions-cancel-waste-audit/scripts/cancel-waste-audit.sh
输出约定
- - 报告模式下退出码为 0(默认)
- 如果 FAILONCRITICAL=1 且至少有一个运行的浪费时间达到/超过 CRITICALWASTEDMINUTES,则退出码为 1
- 在 text 模式下:打印摘要和主要浪费热点
- 在 json 模式下:打印摘要、分组统计和严重运行实例