GitHub Actions Run Gap Audit
Use this skill to detect workflow groups that have gone unexpectedly quiet (stale triggers, broken schedules, disabled automation, branch drift).
What this skill does
- - Reads GitHub Actions run JSON exports
- Groups by repository + workflow + branch + event
- Computes historical cadence (median and p90 interval hours)
- Compares latest inactivity gap vs historical cadence
- Scores risk severity (
ok, warn, critical) - Emits text or JSON for CI checks and automation guardrails
Inputs
Optional:
- -
RUN_GLOB (default: artifacts/github-actions/*.json) - INLINECODE5 (default:
20) - INLINECODE7 (
text or json, default: text) - INLINECODE11 (default:
4) - INLINECODE13 (default:
2.0) - INLINECODE15 (default:
3.5) - INLINECODE17 (default:
12) - INLINECODE19 (default:
24) - INLINECODE21 (regex, optional)
- INLINECODE22 (regex, optional)
- 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 (optional fixed evaluation time for deterministic CI tests)
- INLINECODE34 (
0 or 1, default: 0)
Collect run JSON
CODEBLOCK0
Run
Text report:
CODEBLOCK1
JSON output with fail gate:
CODEBLOCK2
Targeted run-scope triage:
CODEBLOCK3
Run with bundled fixtures:
CODEBLOCK4
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 stale workflow groups
- JSON mode prints summary + ranked groups + critical group details
技能名称: github-actions-run-gap-audit
详细描述:
GitHub Actions 运行间隔审计
使用此技能检测意外停止运行的工作流组(触发器失效、计划任务中断、自动化禁用、分支漂移)。
技能功能
- - 读取 GitHub Actions 运行记录的 JSON 导出文件
- 按仓库 + 工作流 + 分支 + 事件进行分组
- 计算历史运行节奏(中位数和 P90 间隔小时数)
- 比较最新不活动间隔与历史运行节奏
- 评估风险等级(ok 正常、warn 警告、critical 严重)
- 输出文本或 JSON 格式结果,用于 CI 检查和自动化防护
输入参数
可选参数:
- - RUNGLOB(默认值:artifacts/github-actions/*.json)
- TOPN(默认值:20)
- OUTPUTFORMAT(text 或 json,默认值:text)
- MINRUNS(默认值:4)
- WARNGAPMULTIPLIER(默认值:2.0)
- CRITICALGAPMULTIPLIER(默认值:3.5)
- MINWARNGAPHOURS(默认值:12)
- MINCRITICALGAPHOURS(默认值:24)
- WORKFLOWMATCH(正则表达式,可选)
- WORKFLOWEXCLUDE(正则表达式,可选)
- BRANCHMATCH(正则表达式,可选)
- BRANCHEXCLUDE(正则表达式,可选)
- EVENTMATCH(正则表达式,可选)
- EVENTEXCLUDE(正则表达式,可选)
- REPOMATCH(正则表达式,可选)
- REPOEXCLUDE(正则表达式,可选)
- RUNIDMATCH(正则表达式,可选)
- RUNIDEXCLUDE(正则表达式,可选)
- RUNURLMATCH(正则表达式,可选)
- RUNURLEXCLUDE(正则表达式,可选)
- NOWISO(可选,用于确定性 CI 测试的固定评估时间)
- 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 \
MIN_RUNS=5 \
WARNGAPMULTIPLIER=2.25 \
bash skills/github-actions-run-gap-audit/scripts/run-gap-audit.sh
带失败门的 JSON 输出:
bash
RUN_GLOB=artifacts/github-actions/*.json \
OUTPUT_FORMAT=json \
FAILONCRITICAL=1 \
bash skills/github-actions-run-gap-audit/scripts/run-gap-audit.sh
定向运行范围分类:
bash
RUN_GLOB=artifacts/github-actions/*.json \
RUNIDMATCH=^(88|89) \
RUNURLEXCLUDE=rerun \
OUTPUT_FORMAT=json \
bash skills/github-actions-run-gap-audit/scripts/run-gap-audit.sh
使用捆绑测试数据运行:
bash
RUN_GLOB=skills/github-actions-run-gap-audit/fixtures/*.json \
NOW_ISO=2026-03-07T00:00:00Z \
bash skills/github-actions-run-gap-audit/scripts/run-gap-audit.sh
输出约定
- - 报告模式下退出码为 0(默认)
- 当 FAILONCRITICAL=1 且存在一个或多个严重等级组时,退出码为 1
- 文本模式输出摘要 + 按风险排序的停滞工作流组
- JSON 模式输出摘要 + 排序后的组 + 严重等级组详情