GitHub Actions Stuck Run Audit
Use this skill to catch workflows that are stuck in queued/in-progress states for too long.
What this skill does
- - Reads GitHub Actions run JSON exports
- Detects stale runs in non-terminal statuses (
queued, in_progress, etc.) - Aggregates stuck risk by repo/workflow (or repo/branch)
- Scores severity with stuck-age, stuck-run volume, and stuck-rate thresholds
- Emits
ok / warn / critical and can fail CI gates
Inputs
Optional:
- -
RUN_GLOB (default: artifacts/github-actions/*.json) - INLINECODE7 (default:
20) - INLINECODE9 (
text or json, default: text) - INLINECODE13 (
repo, repo-workflow, repo-workflow-branch; default: repo-workflow) - INLINECODE18 (optional ISO timestamp override for deterministic replay)
- INLINECODE19 (comma list, default:
queued,in_progress,pending,waiting,requested) - INLINECODE21 (default:
45) - INLINECODE23 (default:
120) - INLINECODE25 (default:
2) - INLINECODE27 (default:
4) - INLINECODE29 (0..1, default:
0.2) - INLINECODE31 (0..1, default:
0.45) - INLINECODE33 (default:
1) - INLINECODE35 /
WORKFLOW_EXCLUDE (regex, optional) - INLINECODE37 /
BRANCH_EXCLUDE (regex, optional) - INLINECODE39 /
EVENT_EXCLUDE (regex, optional) - INLINECODE41 /
REPO_EXCLUDE (regex, optional) - INLINECODE43 /
STATUS_EXCLUDE (regex, optional) - INLINECODE45 (
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 stuck-risk groups
- JSON mode prints summary + ranked groups + critical groups
GitHub Actions 卡住运行审计
使用此技能来捕获长时间处于排队/进行中状态的工作流。
此技能的功能
- - 读取 GitHub Actions 运行 JSON 导出文件
- 检测处于非终端状态(queued、in_progress 等)的陈旧运行
- 按仓库/工作流(或仓库/分支)聚合卡住风险
- 使用卡住时长、卡住运行数量和卡住率阈值进行严重性评分
- 输出 ok / warn / critical 状态,并可触发 CI 门禁失败
输入参数
可选参数:
- - RUNGLOB(默认值:artifacts/github-actions/*.json)
- TOPN(默认值:20)
- OUTPUTFORMAT(text 或 json,默认值:text)
- GROUPBY(repo、repo-workflow、repo-workflow-branch;默认值:repo-workflow)
- NOWISO(可选 ISO 时间戳覆盖,用于确定性回放)
- STUCKSTATUSES(逗号分隔列表,默认值:queued,inprogress,pending,waiting,requested)
- WARNSTUCKMINUTES(默认值:45)
- CRITICALSTUCKMINUTES(默认值:120)
- WARNSTUCKRUNS(默认值:2)
- CRITICALSTUCKRUNS(默认值:4)
- WARNSTUCKRATE(0..1,默认值:0.2)
- CRITICALSTUCKRATE(0..1,默认值:0.45)
- MINRUNS(默认值:1)
- WORKFLOWMATCH / WORKFLOWEXCLUDE(正则表达式,可选)
- BRANCHMATCH / BRANCHEXCLUDE(正则表达式,可选)
- EVENTMATCH / EVENTEXCLUDE(正则表达式,可选)
- REPOMATCH / REPOEXCLUDE(正则表达式,可选)
- STATUSMATCH / STATUSEXCLUDE(正则表达式,可选)
- FAILONCRITICAL(0 或 1,默认值:0)
收集运行 JSON
bash
gh run view \
--json databaseId,workflowName,event,headBranch,status,conclusion,createdAt,runStartedAt,updatedAt,url,repository \
> artifacts/github-actions/run-.json
运行
文本报告:
bash
RUN_GLOB=artifacts/github-actions/*.json \
bash skills/github-actions-stuck-run-audit/scripts/stuck-run-audit.sh
JSON 输出 + 门禁失败:
bash
RUN_GLOB=artifacts/github-actions/*.json \
OUTPUT_FORMAT=json \
FAILONCRITICAL=1 \
bash skills/github-actions-stuck-run-audit/scripts/stuck-run-audit.sh
针对捆绑的测试数据运行:
bash
NOW_ISO=2026-03-08T00:00:00Z \
RUN_GLOB=skills/github-actions-stuck-run-audit/fixtures/*.json \
bash skills/github-actions-stuck-run-audit/scripts/stuck-run-audit.sh
输出约定
- - 报告模式下退出码为 0(默认)
- 当 FAILONCRITICAL=1 且一个或多个组处于严重状态时,退出码为 1
- 文本模式打印摘要 + 排序后的卡住风险组
- JSON 模式打印摘要 + 排序后的组 + 严重组