🤖 AI 驱动的 GitHub Actions 工作流生成、审查与优化 —— 5 套模板 · 3 项强制配置 · 12 道质量门 · 6 语言缓存策略 · 全平台通用
🤖 AI-powered GitHub Actions workflow generation, review & optimization — 5 Templates · 3 Mandatory Configs · 12 Quality Gates · 6 Cache Strategies · Universal for all AI agents
graph TD
REQ[用户请求 / User Request] --> DET{关键词匹配 / Keyword Match}
DET -->|PR / push / lint / test| A[CI 工作流 / CI Workflow]
DET -->|Tag / Release / publish| B[发布工作流 / Release Workflow]
DET -->|cron / scheduled / deps| C[定时工作流 / Scheduled Workflow]
DET -->|security / scan / CodeQL| D[安全工作流 / Security Workflow]
DET -->|Issue / PR / label| E[自动化工作流 / Automation Workflow]
A --> INJECT{强制注入 / Mandatory Injection}
B --> INJECT
C --> INJECT
D --> INJECT
E --> INJECT
INJECT --> PERM[最小权限 / Least-Privilege]
INJECT --> CONC[并发控制 / Concurrency Control]
INJECT --> PIN[SHA-1 版本锁定 / SHA-1 Pinning]
PERM & CONC & PIN --> CACHE{语言检测与缓存 / Language Detect & Cache}
CACHE --> NODE[npm / pnpm 缓存]
CACHE --> PY[pip 缓存]
CACHE --> GO[Go 缓存]
CACHE --> RUST[target/ 缓存]
NODE & PY & GO & RUST --> AUDIT[12 道质量门 / 12 Quality Gates]
AUDIT --> OUT[生产级 YAML / Production-Grade YAML]
style OUT fill:#2da44e,color:#fff
style DET fill:#6e40c9,color:#fff
style INJECT fill:#d73a49,color:#fff
| 🔮 Claude Code | 🖱️ Cursor | 🤖 GitHub Copilot | 🌊 Windsurf / Aider / Cline |
cp SKILL.md \
.claude/skills/
github-actions.md |
cp PROMPT.md \
.cursor/rules/
github-actions.md |
cp PROMPT.md \
.github/copilot-
instructions.md |
使用 |
| 能力 Capability | 说明 Description |
|---|---|
| 🔧 CI 生成 / CI Generation | 全流程 Lint → Test → Build,自动检测语言生态 / Auto-detect language ecosystem |
| 📦 自动发布 / Auto Release | Tag 触发自动构建、打包并创建 Release / Tag-triggered build, package & release |
| 🛡️ 安全审查 / Security Audit | 最小权限声明、SHA-1 锁定、密钥泄漏扫描 / Least-privilege, SHA-1 pinning, secret scan |
| ⚡ 性能优化 / Perf Optimization | 缓存策略匹配、Job 并行拆分、Runner 选择建议 / Cache matching, job parallelization, runner advice |
| 🔒 强制配置 / Mandatory Config | permissions · concurrency · SHA 锁定,三项缺一不可 / 3 mandatory configs — none can be omitted |
| 🌍 多语言覆盖 / Multi-language | Node.js · Python · Go · Rust · Docker,缓存策略全覆盖 / 6 cache strategies fully covered |
| 文件 File | 语言 Language | 说明 Description |
|---|---|---|
SKILL.md |
🇬🇧 EN | Claude Code 格式(含 YAML 元数据) / Claude Code format (with YAML metadata) |
SKILL.cn.md |
🇨🇳 中文 | Claude Code 格式(含 YAML 元数据) / Claude Code format (with YAML metadata) |
PROMPT.md |
🇬🇧 EN | 通用版 / Universal edition (Cursor / Copilot / Windsurf 等) |
PROMPT.cn.md |
🇨🇳 中文 | 通用版 / Universal edition (Cursor / Copilot / Windsurf 等) |
examples/ |
⚙️ YAML | 5 个真实语言/场景的生成示例 / 5 real-world generation examples |
CONTRIBUTING.md |
🇬🇧 EN | 贡献指南 / Contributing guide |
本仓库的 CI 由此 Skill 亲自生成 —— 自己吃自己的狗粮 🦴
This repo's CI is generated by this very Skill — eating our own dog food 🦴
.github/workflows/ci.yml 是本 Skill 的直接产物:最小权限、并发控制、SHA-1 锁定、缓存优化 —— 无一遗漏。
.github/workflows/ci.yml is a direct output of this Skill: least privilege, concurrency control, SHA-1 pinning, cache optimization — nothing missed.
| 示例 Example | 语言 Language | 场景 Scenario |
|---|---|---|
nodejs-ci.yml |
Node.js | ESLint + Jest,npm 缓存,SHA 锁定 / npm cache, SHA-pinned |
python-ci.yml |
Python | Ruff + Pytest,pip 缓存,多版本矩阵 / pip cache, multi-version matrix |
go-ci.yml |
Go | golangci-lint + go test -race,Go 缓存 / Go cache |
release.yml |
通用 | Tag 触发自动发布 / Tag-triggered release |
multi-lang-matrix.yml |
Rust + Node.js | Monorepo 前后端并行 CI / Monorepo frontend + backend parallel CI |
MIT — 欢迎 Fork、修改和分享 / Feel free to fork, modify, and share.