GitHub Actions Failure Hour Audit
Use this skill to identify when failures cluster so teams can target flaky time windows and on-call coverage.
What this skill does
- - Reads one or more GitHub Actions workflow run JSON exports
- Keeps only failure-like conclusions (
failure, cancelled, timed_out, action_required, startup_failure) - Buckets failures into day/hour windows (with optional timezone offset)
- Ranks windows by severity using failure-run thresholds
- Emits text or JSON output for dashboards or CI gates
Inputs
Optional:
- -
RUN_GLOB (default: artifacts/github-actions/*.json) - INLINECODE7 (default:
24) - INLINECODE9 (
text or json, default: text) - INLINECODE13 (default:
3) - INLINECODE15 (default:
6) - INLINECODE17 (
0 or 1, default: 0) - INLINECODE21 (default:
0) — integer timezone shift from UTC, between -23 and INLINECODE24 - INLINECODE25 ,
WORKFLOW_EXCLUDE (regex, optional) - INLINECODE27 ,
BRANCH_EXCLUDE (regex, optional) - INLINECODE29 ,
REPO_EXCLUDE (regex, optional)
Collect run JSON
CODEBLOCK0
Run
Text report:
CODEBLOCK1
JSON output + fail gate:
CODEBLOCK2
Output contract
- - Exit
0 in reporting mode - Exit
1 when FAIL_ON_CRITICAL=1 and one or more critical windows are found - Text output includes summary and top windows by severity
- JSON output includes
summary, ranked windows, and INLINECODE36
GitHub Actions 失败时段审计
使用此技能识别失败集中的时段,帮助团队定位不稳定的时间窗口和值班覆盖范围。
技能功能
- - 读取一个或多个 GitHub Actions 工作流运行的 JSON 导出文件
- 仅保留类似失败的结论(failure、cancelled、timedout、actionrequired、startup_failure)
- 将失败按天/小时窗口分组(支持可选的时区偏移)
- 使用失败运行阈值按严重程度对窗口进行排序
- 输出文本或 JSON 格式结果,用于仪表盘或 CI 关卡
输入参数
可选参数:
- - RUNGLOB(默认值:artifacts/github-actions/*.json)
- TOPN(默认值:24)
- OUTPUTFORMAT(text 或 json,默认值:text)
- WARNFAILURERUNS(默认值:3)
- CRITICALFAILURERUNS(默认值:6)
- FAILONCRITICAL(0 或 1,默认值:0)
- TZOFFSETHOURS(默认值:0)— 相对于 UTC 的整数时区偏移,范围在 -23 到 23 之间
- WORKFLOWMATCH、WORKFLOWEXCLUDE(正则表达式,可选)
- BRANCHMATCH、BRANCHEXCLUDE(正则表达式,可选)
- REPOMATCH、REPO_EXCLUDE(正则表达式,可选)
收集运行 JSON
bash
gh run view --json databaseId,workflowName,headBranch,conclusion,createdAt,updatedAt,url,repository \
> artifacts/github-actions/run-.json
运行
文本报告:
bash
RUN_GLOB=artifacts/github-actions/*.json \
WARNFAILURERUNS=3 \
CRITICALFAILURERUNS=6 \
TZOFFSETHOURS=7 \
bash skills/github-actions-failure-hour-audit/scripts/failure-hour-audit.sh
JSON 输出 + 失败关卡:
bash
RUN_GLOB=artifacts/github-actions/*.json \
OUTPUT_FORMAT=json \
FAILONCRITICAL=1 \
bash skills/github-actions-failure-hour-audit/scripts/failure-hour-audit.sh
输出约定
- - 报告模式下退出码为 0
- 当 FAILONCRITICAL=1 且发现一个或多个严重窗口时,退出码为 1
- 文本输出包含摘要和按严重程度排序的顶部窗口
- JSON 输出包含 summary、排序后的 windows 和 critical_windows