GitHub Actions Commit Health Audit
Use this skill to find commits that repeatedly fail CI so teams can prioritize rollback, revert, or targeted fixes.
What this skill does
- - Reads GitHub Actions run JSON exports
- Groups runs by repository + commit SHA
- Scores commit risk using failure rate, failed-run volume, and workflow spread
- Flags warning/critical commit hotspots
- Emits text or JSON output for CI checks and triage dashboards
Inputs
Optional:
- -
RUN_GLOB (default: artifacts/github-actions/*.json) - INLINECODE2 (default:
20) - INLINECODE4 (
text or json, default: text) - INLINECODE8 (default:
2) - INLINECODE10 (regex, optional)
- INLINECODE11 (regex, optional)
- INLINECODE12 (regex, optional)
- INLINECODE13 (regex, optional)
- INLINECODE14 (regex, optional)
- INLINECODE15 (regex, optional)
- INLINECODE16 (regex, optional)
- INLINECODE17 (regex, optional)
- INLINECODE18 (default:
25) - INLINECODE20 (default:
50) - INLINECODE22 (default:
35) - INLINECODE24 (default:
60) - INLINECODE26 (
0 or 1, default: 0)
Collect run JSON
CODEBLOCK0
Run
Text report:
CODEBLOCK1
JSON output with fail gate:
CODEBLOCK2
Run with bundled fixtures:
CODEBLOCK3
Output contract
- - Exit
0 in report mode (default) - Exit
1 when FAIL_ON_CRITICAL=1 and one or more commits are critical - Text mode prints summary + ranked commit-risk groups
- JSON mode prints summary + scored groups + critical commit details
技能名称:github-actions-commit-health-audit
详细描述:
GitHub Actions 提交健康审计
使用此技能查找持续集成(CI)反复失败的提交,以便团队优先处理回滚、还原或针对性修复。
此技能的功能
- - 读取 GitHub Actions 运行记录的 JSON 导出文件
- 按仓库 + 提交 SHA 对运行记录进行分组
- 根据失败率、失败运行数量和工作流分布对提交风险进行评分
- 标记警告/严重级别的提交热点
- 输出文本或 JSON 格式结果,用于 CI 检查和分类仪表板
输入参数
可选参数:
- - RUNGLOB(默认值:artifacts/github-actions/*.json)
- TOPN(默认值:20)
- OUTPUTFORMAT(text 或 json,默认值:text)
- MINRUNS(默认值:2)
- BRANCHMATCH(正则表达式,可选)
- BRANCHEXCLUDE(正则表达式,可选)
- WORKFLOWMATCH(正则表达式,可选)
- WORKFLOWEXCLUDE(正则表达式,可选)
- REPOMATCH(正则表达式,可选)
- REPOEXCLUDE(正则表达式,可选)
- SHAMATCH(正则表达式,可选)
- SHAEXCLUDE(正则表达式,可选)
- FAILWARNPERCENT(默认值:25)
- FAILCRITICALPERCENT(默认值:50)
- WARNSCORE(默认值:35)
- CRITICALSCORE(默认值:60)
- FAILONCRITICAL(0 或 1,默认值:0)
收集运行 JSON
bash
gh run view --json databaseId,workflowName,event,conclusion,headBranch,headSha,createdAt,updatedAt,startedAt,url,repository \
> artifacts/github-actions/run-.json
运行
文本报告:
bash
RUN_GLOB=artifacts/github-actions/*.json \
MIN_RUNS=3 \
bash skills/github-actions-commit-health-audit/scripts/commit-health-audit.sh
带失败门控的 JSON 输出:
bash
RUN_GLOB=artifacts/github-actions/*.json \
OUTPUT_FORMAT=json \
FAILONCRITICAL=1 \
bash skills/github-actions-commit-health-audit/scripts/commit-health-audit.sh
使用内置测试数据运行:
bash
RUN_GLOB=skills/github-actions-commit-health-audit/fixtures/*.json \
bash skills/github-actions-commit-health-audit/scripts/commit-health-audit.sh
输出约定
- - 报告模式下退出码为 0(默认)
- 当 FAILONCRITICAL=1 且存在一个或多个严重提交时,退出码为 1
- 文本模式输出摘要 + 按风险排序的提交分组
- JSON 模式输出摘要 + 评分分组 + 严重提交详情