360 Secure SkillHub
360 安全技能中心

github-ci

面向 GitHub Actions 的 CI 工作流编写与维护指南,覆盖 workflow YAML 结构、触发事件与作业、runner 选型、矩阵构建与缓存、测试与覆盖率上报、密钥与权限安全;通过意图路由按需加载四份参考文件,并给出用容器化 yamllint 校验工作流 YAML 的命令。

greedychipmunk
热度 0.00
最近更新 2026-10-18 21:21:11
分类:开发依赖:代码执行 / 第三方 API / 读写文件应用场景:DevOps / 代码生成 / 自动化脚本

安装技能

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

执行命令安装此 skill: npx secure-skills-cli add greedychipmunk/agent-skills/github-ci
Metadata
name
github-ci
description
Write and maintain GitHub Actions CI workflows, including workflow YAML structure, triggers, runners, matrix builds, caching, testing patterns, and secrets management. Use when working with .github/workflows, GitHub Actions, CI pipelines, workflow dispatch, or action configuration.
license
MIT
metadata
{"author":"greedychipmunk","version":"1.0"}

GitHub CI

Write and maintain GitHub Actions CI workflows with confidence. This skill covers workflow design, runner configuration, testing patterns, and security best practices for continuous integration pipelines on GitHub.


Intent Router

Load reference files for depth on specific topics:

Topic File Load when...
Workflow Basics resources/workflow-basics.md Learning workflow YAML structure, triggers, jobs, and built-in actions
Runners & Caching resources/runners-and-caching.md Configuring runners, setting up caching, or optimizing build performance
Testing Patterns resources/testing-patterns.md Implementing test runs, reporting results, or integrating coverage tools
Security & Secrets resources/security-and-secrets.md Managing secrets, permissions, and third-party action safety

Quick Start

Basic GitHub Actions Workflow

  1. Create workflow file — Save as .github/workflows/ci.yml in repository root
  2. Define triggers — Use on: to specify when workflow runs (push, pull_request, schedule)
  3. Configure job — Define jobs with name, runner type, and steps
  4. Add checkout — Use actions/checkout@v4 to access repository code
  5. Run commands — Add steps with run: or use community actions

Minimal Workflow

name: CI

on:
  push:
    branches: [main]
  pull_request:
    branches: [main]

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - run: echo "Running CI pipeline"

Workflow Anatomy

workflow
├── name: Display name
├── on: Trigger events (push, pull_request, schedule, workflow_dispatch)
├── env: Workflow-level environment variables
└── jobs:
    └── <job-name>:
        ├── runs-on: Runner type (ubuntu-latest, windows-latest, macos-latest)
        ├── env: Job-level environment variables
        ├── strategy: Matrix, fail-fast, max-parallel settings
        └── steps:
            ├── uses: Pre-built action
            └── run: Shell command or script

File Location

All workflows must be in .github/workflows/ directory with .yml or .yaml extension. Use kebab-case for filenames: build-and-test.yml, deploy-production.yml.

Quick Validation

Validate YAML syntax before pushing:

docker run --rm -v "$(pwd):/data" pipelinecomponents/yamllint yamllint /data/.github/workflows/