360 Secure SkillHub
360 安全技能中心

GitHub Actions Artifact Budget Audit

核心功能:读取GitHub Actions构件JSON导出,计算存储大小并按仓库+构件名统计,可按配置阈值标记警告/严重构件,高亮即将过期的构件体积以优先清理,支持文本/JSON输出。典型场景:多仓库CI构件成本管控,提前识别臃肿构件避免成本膨胀。输入为可选配置参数,输出可生成终端报告或仪表盘用JSON,还可配置严重构件时触发失败。

daniellummis
daniellummis
热度 51.80
最近更新 2026-05-11 17:29:08
分类:数据依赖:代码执行 / 读写文件应用场景:DevOps / 报告撰写 / 数据处理

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add github-actions-artifact-budget-audit
Metadata
name
github-actions-artifact-budget-audit
description
Audit GitHub Actions artifact storage usage from JSON exports so bloated artifacts are flagged before they inflate CI cost.
version
1.0.0
metadata
{"openclaw":{"requires":{"bins":["bash","python3"]}}}

GitHub Actions Artifact Budget Audit

Use this skill to detect oversized or stale GitHub Actions artifacts across repositories.

What this skill does

  • Reads one or more GitHub artifact JSON exports (gh api output)
  • Calculates artifact size in MB and totals by repository + artifact name
  • Flags warn/critical artifacts by configurable size thresholds
  • Highlights soon-to-expire artifact volume to prioritize cleanup
  • Supports text and JSON output for terminal or dashboards

Inputs

Optional:

  • ARTIFACT_GLOB (default: artifacts/github-actions-artifacts/*.json)
  • TOP_N (default: 20)
  • OUTPUT_FORMAT (text or json, default: text)
  • WARN_MB (default: 250)
  • CRITICAL_MB (default: 750)
  • SOON_EXPIRES_DAYS (default: 7)
  • FAIL_ON_CRITICAL (0 or 1, default: 0)
  • REPO_MATCH (regex, optional)
  • REPO_EXCLUDE (regex, optional)
  • ARTIFACT_MATCH (regex, optional)
  • ARTIFACT_EXCLUDE (regex, optional)

Collect artifact JSON

Single repository:

gh api repos/<owner>/<repo>/actions/artifacts --paginate \
  > artifacts/github-actions-artifacts/<owner>-<repo>.json

Combined multi-repo payloads are also supported as long as each file includes an artifacts array.

Run

Text report:

ARTIFACT_GLOB='artifacts/github-actions-artifacts/*.json' \
WARN_MB=300 \
CRITICAL_MB=900 \
bash skills/github-actions-artifact-budget-audit/scripts/artifact-budget-audit.sh

JSON output for automation:

ARTIFACT_GLOB='artifacts/github-actions-artifacts/*.json' \
OUTPUT_FORMAT=json \
FAIL_ON_CRITICAL=1 \
bash skills/github-actions-artifact-budget-audit/scripts/artifact-budget-audit.sh

Filter to one repo and artifact family:

ARTIFACT_GLOB='artifacts/github-actions-artifacts/*.json' \
REPO_MATCH='^flowcreatebot/' \
ARTIFACT_MATCH='(test-results|coverage)' \
bash skills/github-actions-artifact-budget-audit/scripts/artifact-budget-audit.sh

Run with bundled fixtures:

ARTIFACT_GLOB='skills/github-actions-artifact-budget-audit/fixtures/*.json' \
bash skills/github-actions-artifact-budget-audit/scripts/artifact-budget-audit.sh

Output contract

  • Exit 0 in reporting mode (default)
  • Exit 1 if FAIL_ON_CRITICAL=1 and at least one artifact is at/above CRITICAL_MB
  • In text mode: prints summary and top oversized artifact groups
  • In json mode: prints summary, grouped artifact stats, and critical artifact instances