跳到正文
Skillpedia
部署与云(DevOps)33k · #8763

github-actions-creator

它能做什么

这个技能为任何语言的项目创建 GitHub Actions 自动化文件。适合希望在每次推送变更时自动检查或发布代码的人员。

适用场景

  • ✓你希望在每次推送或拉取请求时自动运行测试的时候。
  • ✓你希望自动构建、检查代码风格或扫描安全问题的时候。
  • ✓你希望在计划时间或打标签时自动发布或构建 Docker 镜像的时候。

技能链接

https://github.com/davila7/claude-code-templates/blob/main/cli-tool/components/skills/development/github-actions-creator/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/davila7/claude-code-templates/blob/main/cli-tool/components/skills/development/github-actions-creator/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“请创建一个 GitHub Actions 工作流,在我每次发起拉取请求时运行我的测试。”

每周 5 个新技能,1 分钟读完。

工作原理

这个技能扫描你的项目以确定语言、现有工作流和工具,在需要时提出澄清问题,然后编写可用于生产环境的工作流文件。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

GitHub Actions Creator

You are an expert at creating GitHub Actions workflows. When the user asks you to create a GitHub Action, follow this structured process to deliver a production-ready workflow file.

Workflow Creation Process

Step 1: Analyze the Project

Before writing any YAML, scan the project to understand the stack:

  1. Check for language/framework indicators:

    • package.json → Node.js (check for React, Next.js, Vue, Angular, Svelte, etc.)
    • requirements.txt / pyproject.toml / setup.py → Python
    • go.mod → Go
    • Cargo.toml → Rust
    • pom.xml / build.gradle → Java/Kotlin
    • Gemfile → Ruby
    • composer.json → PHP
    • pubspec.yaml → Dart/Flutter
    • Package.swift → Swift
    • *.csproj / *.sln → .NET
  2. Check for existing CI/CD:

    • .github/workflows/ → existing workflows (avoid conflicts)
    • Dockerfile → container builds available
    • docker-compose.yml → multi-service setup
    • vercel.json / netlify.toml → deployment targets
    • terraform/ / pulumi/ → infrastructure as code
  3. Check for tooling:

    • .eslintrc* / eslint.config.* → ESLint configured
    • prettier* → Prettier configured
    • jest.config* / vitest.config* / pytest.ini → test framework
    • .env.example → environment variables needed
    • Makefile → build commands available

Step 2: Ask Clarifying Questions (if needed)

If the user's request is ambiguous, ask ONE focused question. Common clarifications:

  • "Create a CI pipeline" → "Should it run tests only, or also lint and type-check?"
  • "Add deployment" → "Where does this deploy? (Vercel, AWS, GCP, Docker Hub, etc.)"
  • "Set up tests" → "Should tests run on PR only, or also on push to main?"

If the intent is clear, skip this step and proceed.

Step 3: Generate the Workflow

Create the .github/workflows/{name}.yml file following these rules:

File Naming

  • Use descriptive kebab-case names: ci.yml, deploy-production.yml, release.yml
  • For simple CI: ci.yml
  • For deployment: deploy.yml or deploy-{target}.yml
  • For scheduled tasks: scheduled-{task}.yml

YAML Structure Rules

name: Human-readable name        # Always include

on:                               # Use the most specific triggers
  push:
    branches: [main]              # Specify branches explicitly
    paths-ignore:                 # Skip docs-only changes when appropriate
      - '**.md'
      - 'docs/**'
  pull_request:
    branches: [main]

permissions:                      # Always set minimal permissions
  contents: read

concurrency:                      # Prevent duplicate runs on PRs
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true

jobs:
  job-name:
    runs-on: ubuntu-latest        # Default to ubuntu-latest
    timeout-minutes: 15           # Always set a timeout
    steps:
      - uses: actions/checkout@v4 # Always pin to major version

Core Patterns by Use Case

CI (Test + Lint)

Trigger: pull_request + push to main Jobs: lint, test (parallel when possible) Key features: dependency caching, matrix testing for multiple versions

Deployment

Trigger: push to main (or release tags) Jobs: test → build → deploy (sequential with needs) Key features: environment protection, secrets for credentials, status checks

Release / Publish

Trigger: push tags matching v* or workflow_dispatch Jobs: test → build → publish → create GitHub Release Key features: changelog generation, artifact upload, npm/PyPI/Docker publish

Scheduled Tasks

Trigger: schedule with cron expression Jobs: single job with the task Key features: workflow_dispatch for manual trigger too, failure notifications

Security Scanning

Trigger: pull_request + schedule (weekly) Jobs: dependency audit, SAST, secret scanning Key features: SARIF upload to GitHub Security tab, fail on critical

Docker Build & Push

Trigger: push to main + tags Jobs: build → push to registry Key features: multi-platform builds, layer caching, image tagging strategy

Essential Actions Reference

Setup Actions (always pin to major version)

Action Purpose
actions/checkout@v4 Clone repository
actions/setup-node@v4 Node.js with caching
actions/setup-python@v5 Python with caching
actions/setup-go@v5 Go with caching
`actions/set
常见问题

它会避免与我现有的工作流冲突吗?

会。这个技能会先检查现有的工作流文件夹,以避免冲突。

它支持哪些语言?

它支持多种语言,包括 JavaScript、Python、Go、Rust、Java、Ruby 和 .NET。

它会在写文件前提问吗?

会。当项目没有把目标说清楚时,它会提出澄清问题。

详情

作者的原始描述

Use when the user wants to create, generate, or set up a GitHub Actions workflow. Handles CI/CD pipelines, testing, deployment, linting, security scanning, release automation, Docker builds, scheduled tasks, and any custom workflow for any language or framework.

repo: davila7/claude-code-templates

热度

GitHub 星标
33k
排名
#8763
许可证
MIT
更新时间
2026/11/2

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能