GitHub Actions Branch Drift Audit
Use this skill to catch branch-specific CI reliability regressions before they spread into your mainline release flow.
What this skill does
- - Reads GitHub Actions run JSON exports
- Groups runs by repository + workflow + branch
- Selects a baseline branch per repository/workflow (defaults to
main|master) - Compares each non-baseline branch against that baseline on:
- failure-rate drift (percentage points)
- average runtime drift (ratio)
- - Flags warning/critical drift severity and supports CI fail gates
- Emits text or JSON output for pipeline checks and triage dashboards
Inputs
Optional:
- -
RUN_GLOB (default: artifacts/github-actions/*.json) - INLINECODE3 (default:
20) - INLINECODE5 (
text or json, default: text) - INLINECODE9 (default:
2) - INLINECODE11 (default:
2) - INLINECODE13 (default:
^(main|master)$) - INLINECODE15 (regex, optional)
- INLINECODE16 (regex, optional)
- INLINECODE17 (regex, optional)
- INLINECODE18 (regex, optional)
- INLINECODE19 (default:
10) - INLINECODE21 (default:
25) - INLINECODE23 (default:
1.25) - INLINECODE25 (default:
1.6) - INLINECODE27 (
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 drift rows are critical - Text mode prints summary + ranked branch drift rows
- JSON mode prints summary + drift rows + critical-only slice
GitHub Actions 分支漂移审计
使用此技能可在分支特定的CI可靠性回归扩散到主线发布流程之前捕获它们。
此技能的功能
- - 读取GitHub Actions运行的JSON导出文件
- 按仓库 + 工作流 + 分支对运行进行分组
- 为每个仓库/工作流选择基线分支(默认为main|master)
- 将每个非基线分支与基线分支在以下方面进行比较:
- 失败率漂移(百分比点)
- 平均运行时间漂移(比率)
- - 标记警告/严重漂移程度,并支持CI失败门控
- 输出文本或JSON格式,用于流水线检查和分类仪表板
输入参数
可选参数:
- - RUNGLOB(默认值:artifacts/github-actions/*.json)
- TOPN(默认值:20)
- OUTPUTFORMAT(text或json,默认值:text)
- MINRUNSPERBRANCH(默认值:2)
- MINBRANCHES(默认值:2)
- BASELINEBRANCHMATCH(默认值:^(main|master)$)
- WORKFLOWMATCH(正则表达式,可选)
- WORKFLOWEXCLUDE(正则表达式,可选)
- REPOMATCH(正则表达式,可选)
- REPOEXCLUDE(正则表达式,可选)
- FAILUREDRIFTWARNPP(默认值:10)
- FAILUREDRIFTCRITICALPP(默认值:25)
- RUNTIMEDRIFTWARNRATIO(默认值:1.25)
- RUNTIMEDRIFTCRITICALRATIO(默认值:1.6)
- FAILON_CRITICAL(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 \
BASELINEBRANCHMATCH=^(main|release/.*)$ \
MINRUNSPER_BRANCH=3 \
bash skills/github-actions-branch-drift-audit/scripts/branch-drift-audit.sh
带失败门控的JSON输出:
bash
RUN_GLOB=artifacts/github-actions/*.json \
OUTPUT_FORMAT=json \
FAILONCRITICAL=1 \
bash skills/github-actions-branch-drift-audit/scripts/branch-drift-audit.sh
使用捆绑的测试数据运行:
bash
RUN_GLOB=skills/github-actions-branch-drift-audit/fixtures/*.json \
bash skills/github-actions-branch-drift-audit/scripts/branch-drift-audit.sh
输出约定
- - 报告模式下退出码为0(默认)
- 当FAILONCRITICAL=1且存在一个或多个严重漂移行时,退出码为1
- 文本模式打印摘要 + 排名分支漂移行
- JSON模式打印摘要 + 漂移行 + 仅严重漂移切片