GitHub Actions Duplicate Run Audit
Use this skill to detect accidental duplicate workflow execution bursts (for example trigger overlap, force-push storms, or retried dispatches) and measure wasted CI minutes.
What this skill does
- - Reads GitHub Actions run JSON exports
- Groups runs by repository + workflow + branch + event + commit SHA
- Clusters bursts where runs happen inside a configurable time window
- Counts duplicate runs and estimates wasted runtime minutes
- Scores severity (
ok, warn, critical) for CI hygiene enforcement - Emits text or JSON for automation
Inputs
Optional:
- -
RUN_GLOB (default: artifacts/github-actions/*.json) - INLINECODE5 (default:
20) - INLINECODE7 (
text or json, default: text) - INLINECODE11 (default:
30) - INLINECODE13 (default:
2) - INLINECODE15 (default:
3) - INLINECODE17 (default:
6) - INLINECODE19 (default:
20) - INLINECODE21 (default:
60) - INLINECODE23 (regex, optional)
- INLINECODE24 (regex, optional)
- INLINECODE25 (regex, optional)
- INLINECODE26 (regex, optional)
- INLINECODE27 (regex, optional)
- INLINECODE28 (regex, optional)
- INLINECODE29 (regex, optional)
- INLINECODE30 (regex, optional)
- INLINECODE31 (regex, optional)
- INLINECODE32 (regex, optional)
- INLINECODE33 (
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 groups are critical - Text mode prints summary + ranked duplicate-run groups
- JSON mode prints summary + ranked groups + critical groups
GitHub Actions 重复运行审计
使用此技能检测意外的重复工作流执行突发(例如触发器重叠、强制推送风暴或重试调度),并衡量浪费的CI分钟数。
此技能的功能
- - 读取GitHub Actions运行JSON导出文件
- 按仓库 + 工作流 + 分支 + 事件 + 提交SHA对运行进行分组
- 在可配置的时间窗口内对运行突发进行聚类
- 统计重复运行次数并估算浪费的运行分钟数
- 对CI卫生执行进行严重性评分(ok、warn、critical)
- 输出文本或JSON格式用于自动化
输入参数
可选参数:
- - RUNGLOB(默认值:artifacts/github-actions/*.json)
- TOPN(默认值:20)
- OUTPUTFORMAT(text或json,默认值:text)
- DUPLICATEWINDOWMINUTES(默认值:30)
- MINDUPLICATERUNS(默认值:2)
- WARNDUPLICATERUNS(默认值:3)
- CRITICALDUPLICATERUNS(默认值:6)
- WARNWASTEDMINUTES(默认值:20)
- CRITICALWASTEDMINUTES(默认值:60)
- WORKFLOWMATCH(正则表达式,可选)
- WORKFLOWEXCLUDE(正则表达式,可选)
- BRANCHMATCH(正则表达式,可选)
- BRANCHEXCLUDE(正则表达式,可选)
- EVENTMATCH(正则表达式,可选)
- EVENTEXCLUDE(正则表达式,可选)
- REPOMATCH(正则表达式,可选)
- REPOEXCLUDE(正则表达式,可选)
- HEADSHAMATCH(正则表达式,可选)
- HEADSHAEXCLUDE(正则表达式,可选)
- 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 \
DUPLICATEWINDOWMINUTES=20 \
bash skills/github-actions-duplicate-run-audit/scripts/duplicate-run-audit.sh
JSON输出 + 失败门控:
bash
RUN_GLOB=artifacts/github-actions/*.json \
OUTPUT_FORMAT=json \
FAILONCRITICAL=1 \
bash skills/github-actions-duplicate-run-audit/scripts/duplicate-run-audit.sh
针对捆绑的测试数据进行运行:
bash
RUN_GLOB=skills/github-actions-duplicate-run-audit/fixtures/*.json \
bash skills/github-actions-duplicate-run-audit/scripts/duplicate-run-audit.sh
输出约定
- - 报告模式下退出码为0(默认)
- 当FAILONCRITICAL=1且一个或多个组为critical时,退出码为1
- 文本模式打印摘要 + 排序后的重复运行组
- JSON模式打印摘要 + 排序后的组 + critical组