用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/UitbreidenOS/UitKit --skill github-actions命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
正在显示 SKILL.md
Guidelines and instructions for Agent execution state rollback rules
Guidelines and instructions for Agent execution step counters limits
Guidelines and instructions for Agent execution timeout limits setups
基于 SOC 职业分类
| name | github-actions |
| description | GitHub Actions workflows, job matrices, caching, secrets, reusable workflows, deployment environments |
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
# Explicit permissions — never use default write-all
permissions:
contents: read
pull-requests: write # Only if needed (e.g., posting comments)
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- run: npm ci
- run: npm test
Never use the default permissions: write-all. Always declare minimum required permissions:
permissions:
contents: read # Read repo
packages: write # Push to GitHub Container Registry
id-token: write # OIDC for cloud auth
pull-requests: write # Comment on PRs
Use OIDC (OpenID Connect) for cloud authentication — no stored secrets:
# AWS OIDC — no AWS_ACCESS_KEY_ID needed
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: arn:aws:iam::123456789:role/github-actions-role
aws-region: eu-west-1
# GCP OIDC
- name: Authenticate to GCP
uses: google-github-actions/auth@v2
with:
workload_identity_provider: projects/123/locations/global/workloadIdentityPools/pool/providers/github
service_account: deploy@project.iam.gserviceaccount.com
Always cache dependencies to cut build time:
# Node.js
- uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm' # Built-in cache — no manual cache step needed
# Python
- uses: actions/setup-python@v5
with:
python-version: '3.12'
cache: 'pip'
# Go
- uses: actions/setup-go@v5
with:
go-version: '1.22'
cache: true
jobs:
deploy-production:
environment: production # References GitHub Environment with protection rules
needs: [test, build]
runs-on: ubuntu-latest
steps:
- name: Deploy
run: ./scripts/deploy.sh
Set up Environment protection rules in GitHub Settings:
main only)jobs:
test:
strategy:
matrix:
node-version: [18, 20, 22]
os: [ubuntu-latest, windows-latest]
fail-fast: false # Don't cancel all on first failure
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
# .github/workflows/deploy.yml — reusable
on:
workflow_call:
inputs:
environment:
required: true
type: string
secrets:
deploy-token:
required: true
# Caller
jobs:
deploy:
uses: ./.github/workflows/deploy.yml
with:
environment: production
secrets:
deploy-token: ${{ secrets.DEPLOY_TOKEN }}
actions/checkout@v4 missing — always the first steppull_request_target carefully (security risk)restore-keys for fallbackUser: Write a CI/CD pipeline for a Node.js app: run tests on PRs, build and push Docker image on merge to main, deploy to production with a manual approval gate.
Expected output:
on: push/pull_request triggerstest job: checkout, setup-node with cache, npm ci, npm testbuild job (on push to main, needs test): Docker build + push to GHCR using OIDCdeploy job: environment: production (requires approval), calls deploy scriptpermissions: block — minimum required