GitHub Actions Failure Matrix
Use this skill to turn noisy GitHub Actions run JSON into a matrix-focused failure report.
What this skill does
- - Reads one or more JSON exports from GitHub Actions runs (via
gh run view --json) - Detects failure-like matrix jobs (
failure, timed_out, cancelled, etc.) - Extracts matrix axes from common job-name patterns (
name (a, b), name [a, b], name / a / b) - Groups repeated failures by workflow + job + matrix axis signature
- Emits ranked triage output in
text or INLINECODE8
Inputs
Optional:
- -
RUN_GLOB (default: artifacts/github-actions/*.json) - INLINECODE11 (default:
20) - INLINECODE13 (
text or json, default: text) - INLINECODE17 (
0 or 1, default: 0) — exit non-zero when failure groups exist - INLINECODE21 (default:
1) — hide groups below this repeat count - INLINECODE23 (regex, optional) — include only workflows whose names match
- INLINECODE24 (regex, optional) — drop workflows whose names match
- INLINECODE25 (regex, optional) — include only runs whose branch names match
- INLINECODE26 (regex, optional) — drop runs whose branch names match
- INLINECODE27 (regex, optional) — include only base job names that match
- INLINECODE28 (regex, optional) — drop base job names that match
- INLINECODE29 (regex, optional) — include only parsed matrix-axis strings that match
- INLINECODE30 (regex, optional) — drop parsed matrix-axis strings that match
- INLINECODE31 (regex, optional) — include only specific failure conclusions (
failure, timed_out, cancelled, etc.) - INLINECODE35 (regex, optional) — drop specific failure conclusions
- INLINECODE36 (regex, optional) — include only jobs whose terminal failed step matches
- INLINECODE37 (regex, optional) — drop jobs whose terminal failed step matches
- INLINECODE38 (regex, optional) — include only runs whose run id matches
- INLINECODE39 (regex, optional) — drop runs whose run id matches
- INLINECODE40 (regex, optional) — include only runs whose URL matches
- INLINECODE41 (regex, optional) — drop runs whose URL matches
- INLINECODE42 (regex, optional) — include only runs whose
headSha matches - INLINECODE44 (regex, optional) — drop runs whose
headSha matches - INLINECODE46 (regex, optional) — include only runs whose repository matches (
repository.nameWithOwner/full_name/name) - INLINECODE50 (regex, optional) — drop runs whose repository matches
Collect run JSON
CODEBLOCK0
Run
Text report:
CODEBLOCK1
JSON output for CI annotation/upload:
CODEBLOCK2
Filter to a specific workflow + branch + matrix axis (for targeted triage):
CODEBLOCK3
Isolate timeout-only matrix failures:
CODEBLOCK4
Exclude noisy flaky suites while keeping the rest of the matrix view:
CODEBLOCK5
Focus only on setup/toolchain breakages by failed step name:
CODEBLOCK6
Limit triage to a specific run range or workflow URL pattern:
CODEBLOCK7
Scope triage to a commit range by headSha:
CODEBLOCK8
Scope triage to specific repositories when aggregating exports from multiple repos:
CODEBLOCK9
Run with bundled fixtures:
CODEBLOCK10
Output contract
- - Exit
0 by default (reporting mode) - Exit
1 if FAIL_ON_FAILURES=1 and at least one failure group is found - In
text mode, prints summary + top failure matrix groups - In
json mode, prints machine-readable summary and grouped failures
GitHub Actions 失败矩阵
使用此技能将嘈杂的 GitHub Actions 运行 JSON 转换为以矩阵为中心的失败报告。
此技能的功能
- - 读取一个或多个来自 GitHub Actions 运行的 JSON 导出(通过 gh run view --json)
- 检测类似失败的矩阵任务(failure、timed_out、cancelled 等)
- 从常见任务名称模式中提取矩阵轴(name (a, b)、name [a, b]、name / a / b)
- 按工作流 + 任务 + 矩阵轴签名对重复失败进行分组
- 以 text 或 json 格式输出排序后的分类结果
输入参数
可选参数:
- - RUNGLOB(默认值:artifacts/github-actions/*.json)
- TOPN(默认值:20)
- OUTPUTFORMAT(text 或 json,默认值:text)
- FAILONFAILURES(0 或 1,默认值:0)— 当存在失败组时以非零退出
- MINOCCURRENCES(默认值:1)— 隐藏低于此重复次数的组
- WORKFLOWMATCH(正则表达式,可选)— 仅包含名称匹配的工作流
- WORKFLOWEXCLUDE(正则表达式,可选)— 排除名称匹配的工作流
- BRANCHMATCH(正则表达式,可选)— 仅包含分支名称匹配的运行
- BRANCHEXCLUDE(正则表达式,可选)— 排除分支名称匹配的运行
- JOBMATCH(正则表达式,可选)— 仅包含匹配的基础任务名称
- JOBEXCLUDE(正则表达式,可选)— 排除匹配的基础任务名称
- AXISMATCH(正则表达式,可选)— 仅包含匹配的解析矩阵轴字符串
- AXISEXCLUDE(正则表达式,可选)— 排除匹配的解析矩阵轴字符串
- CONCLUSIONMATCH(正则表达式,可选)— 仅包含特定的失败结论(failure、timedout、cancelled 等)
- CONCLUSIONEXCLUDE(正则表达式,可选)— 排除特定的失败结论
- FAILEDSTEPMATCH(正则表达式,可选)— 仅包含最终失败步骤匹配的任务
- FAILEDSTEPEXCLUDE(正则表达式,可选)— 排除最终失败步骤匹配的任务
- RUNIDMATCH(正则表达式,可选)— 仅包含运行 ID 匹配的运行
- RUNIDEXCLUDE(正则表达式,可选)— 排除运行 ID 匹配的运行
- RUNURLMATCH(正则表达式,可选)— 仅包含 URL 匹配的运行
- RUNURLEXCLUDE(正则表达式,可选)— 排除 URL 匹配的运行
- HEADSHAMATCH(正则表达式,可选)— 仅包含 headSha 匹配的运行
- HEADSHAEXCLUDE(正则表达式,可选)— 排除 headSha 匹配的运行
- REPOMATCH(正则表达式,可选)— 仅包含仓库匹配的运行(repository.nameWithOwner/fullname/name)
- REPOEXCLUDE(正则表达式,可选)— 排除仓库匹配的运行
收集运行 JSON
bash
gh run view --json databaseId,workflowName,headBranch,headSha,url,repository,jobs \
> artifacts/github-actions/run-.json
运行
文本报告:
bash
RUN_GLOB=artifacts/github-actions/*.json \
TOP_N=15 \
bash skills/github-actions-failure-matrix/scripts/failure-matrix.sh
用于 CI 注释/上传的 JSON 输出:
bash
RUN_GLOB=artifacts/github-actions/*.json \
OUTPUT_FORMAT=json \
FAILONFAILURES=1 \
bash skills/github-actions-failure-matrix/scripts/failure-matrix.sh
过滤到特定工作流 + 分支 + 矩阵轴(用于针对性分类):
bash
RUN_GLOB=artifacts/github-actions/*.json \
WORKFLOW_MATCH=(CI|Test) \
BRANCH_MATCH=^(main|release/) \
AXIS_MATCH=ubuntu-latest \| python-3\.12 \
bash skills/github-actions-failure-matrix/scripts/failure-matrix.sh
隔离仅超时的矩阵失败:
bash
RUN_GLOB=artifacts/github-actions/*.json \
CONCLUSIONMATCH=^timedout$ \
bash skills/github-actions-failure-matrix/scripts/failure-matrix.sh
排除嘈杂的不稳定套件,同时保留矩阵视图的其余部分:
bash
RUN_GLOB=artifacts/github-actions/*.json \
WORKFLOW_EXCLUDE=nightly|experimental \
JOB_EXCLUDE=lint|docs \
AXIS_EXCLUDE=windows-latest \
CONCLUSION_EXCLUDE=^cancelled$ \
bash skills/github-actions-failure-matrix/scripts/failure-matrix.sh
通过失败步骤名称仅关注设置/工具链故障:
bash
RUN_GLOB=artifacts/github-actions/*.json \
FAILEDSTEPMATCH=setup|install|dependency \
bash skills/github-actions-failure-matrix/scripts/failure-matrix.sh
将分类限制到特定运行范围或工作流 URL 模式:
bash
RUN_GLOB=artifacts/github-actions/*.json \
RUNIDMATCH=^(28419|28420) \
RUNURLMATCH=example/repo/actions/runs \
bash skills/github-actions-failure-matrix/scripts/failure-matrix.sh
通过 headSha 将分类范围限定到提交范围:
bash
RUN_GLOB=artifacts/github-actions/*.json \
HEADSHAMATCH=^(abc123|def456) \
bash skills/github-actions-failure-matrix/scripts/failure-matrix.sh
在聚合多个仓库的导出时,将分类范围限定到特定仓库:
bash
RUN_GLOB=artifacts/github-actions/*.json \
REPO_MATCH=^flowcreatebot/(yf-api-saas|conspiracy-canvas)$ \
bash skills/github-actions-failure-matrix/scripts/failure-matrix.sh
使用捆绑的测试数据运行:
bash
RUN_GLOB=skills/github-actions-failure-matrix/fixtures/*.json \
bash skills/github-actions-failure-matrix/scripts/failure-matrix.sh
输出约定
- - 默认退出码为 0(报告模式)
- 如果 FAILONFAILURES=1 且至少找到一个失败组,则退出码为 1
- 在 text 模式下,打印摘要 + 顶部失败矩阵组
- 在 json 模式下,打印机器可读的摘要和分组的失败信息