GitHub Actions Timeout Risk Audit
Use this skill to find GitHub Actions jobs that are timing out or trending dangerously close to timeout limits.
What this skill does
- - Reads one or more run JSON exports (
gh run view --json ...) - Calculates per-job runtime (
completedAt - startedAt) - Flags risk severity by configured timeout threshold:
-
warn when runtime exceeds
WARN_RATIO * JOB_TIMEOUT_SECONDS
-
critical when runtime exceeds
CRITICAL_RATIO * JOB_TIMEOUT_SECONDS
- always
critical for jobs with
conclusion=timed_out
- - Groups repeated jobs by repository + workflow + job name
- Emits text or JSON output for CI gates / dashboards
Inputs
Optional:
- -
RUN_GLOB (default: artifacts/github-actions/*.json) - INLINECODE10 (default:
20) - INLINECODE12 (
text or json, default: text) - INLINECODE16 (default:
3600) - INLINECODE18 (default:
0.80) - INLINECODE20 (default:
0.95) - INLINECODE22 (
0 or 1, default: 0) - INLINECODE26 ,
WORKFLOW_EXCLUDE (regex, optional) - INLINECODE28 ,
JOB_EXCLUDE (regex, optional) - INLINECODE30 ,
REPO_EXCLUDE (regex, optional) - INLINECODE32 ,
BRANCH_EXCLUDE (regex, optional)
Collect run JSON
CODEBLOCK0
Ensure jobs includes startedAt, completedAt, and conclusion.
Run
Text report:
CODEBLOCK1
JSON output + fail gate:
CODEBLOCK2
Repo/workflow filter:
CODEBLOCK3
Run with bundled fixtures:
CODEBLOCK4
Output contract
- - Exit
0 in reporting mode - Exit
1 when FAIL_ON_CRITICAL=1 and at least one critical instance exists - Text output includes summary, thresholds, and top timeout-risk jobs
- JSON output includes
summary, ranked groups, and INLINECODE43
GitHub Actions 超时风险审计
使用此技能查找正在超时或危险地接近超时限制的GitHub Actions作业。
此技能的功能
- - 读取一个或多个运行JSON导出文件(gh run view --json ...)
- 计算每个作业的运行时间(completedAt - startedAt)
- 根据配置的超时阈值标记风险等级:
- 当运行时间超过WARN
RATIO * JOBTIMEOUT_SECONDS时标记为warn
- 当运行时间超过CRITICAL
RATIO * JOBTIMEOUT_SECONDS时标记为critical
- 对于conclusion=timed_out的作业始终标记为critical
- - 按仓库 + 工作流 + 作业名称对重复作业进行分组
- 为CI门控/仪表板输出文本或JSON格式
输入参数
可选参数:
- - RUNGLOB(默认值:artifacts/github-actions/*.json)
- TOPN(默认值:20)
- OUTPUTFORMAT(text或json,默认值:text)
- JOBTIMEOUTSECONDS(默认值:3600)
- WARNRATIO(默认值:0.80)
- CRITICALRATIO(默认值:0.95)
- FAILONCRITICAL(0或1,默认值:0)
- WORKFLOWMATCH、WORKFLOWEXCLUDE(正则表达式,可选)
- JOBMATCH、JOBEXCLUDE(正则表达式,可选)
- REPOMATCH、REPOEXCLUDE(正则表达式,可选)
- BRANCHMATCH、BRANCH_EXCLUDE(正则表达式,可选)
收集运行JSON
bash
gh run view --json databaseId,workflowName,headBranch,url,repository,jobs \
> artifacts/github-actions/run-.json
确保jobs包含startedAt、completedAt和conclusion。
运行
文本报告:
bash
RUN_GLOB=artifacts/github-actions/*.json \
JOBTIMEOUTSECONDS=3600 \
WARN_RATIO=0.85 \
CRITICAL_RATIO=0.95 \
bash skills/github-actions-timeout-risk-audit/scripts/timeout-risk-audit.sh
JSON输出 + 失败门控:
bash
RUN_GLOB=artifacts/github-actions/*.json \
OUTPUT_FORMAT=json \
FAILONCRITICAL=1 \
bash skills/github-actions-timeout-risk-audit/scripts/timeout-risk-audit.sh
仓库/工作流过滤:
bash
RUN_GLOB=artifacts/github-actions/*.json \
REPO_MATCH=^flowcreatebot/ \
WORKFLOW_MATCH=(CI|Build) \
bash skills/github-actions-timeout-risk-audit/scripts/timeout-risk-audit.sh
使用捆绑的测试数据运行:
bash
RUN_GLOB=skills/github-actions-timeout-risk-audit/fixtures/*.json \
bash skills/github-actions-timeout-risk-audit/scripts/timeout-risk-audit.sh
输出约定
- - 报告模式下退出码为0
- 当FAILONCRITICAL=1且存在至少一个严重实例时退出码为1
- 文本输出包含摘要、阈值和超时风险最高的作业
- JSON输出包含summary、排序后的groups和critical_instances