Chuyển đến nội dung
Skillpedia
Triển khai và đám mây (DevOps)48k · #4743

github-actions-advanced

Skill này làm gì

Công cụ này giúp tạo và cải thiện các quy trình tự động trên GitHub (gọi là GitHub Actions). Nó đảm bảo các quy trình xây dựng, kiểm thử và phát hành mã của bạn an toàn và hiệu quả.

Khi nào nên dùng

  • ✓Khi bạn muốn tự động hóa các tác vụ lặp lại trên GitHub.
  • ✓Khi mã của bạn không được xây dựng, kiểm thử hoặc triển khai đúng cách.
  • ✓Khi muốn làm cho quy trình phát triển của bạn an toàn và đáng tin cậy hơn.

Liên kết skill

https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/github-actions-advanced/SKILL.md

Sao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.

Cách dùng

Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.

Tin nhắn có sẵn để dán

Hãy dùng skill này để giúp tôi: https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/github-actions-advanced/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Làm thế nào để thiết lập GitHub Actions để tự động kiểm thử mã của tôi mỗi lần tôi push cập nhật?”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

Công cụ phân tích cấu hình GitHub Actions của bạn và gợi ý cải thiện tập trung vào bảo mật và hiệu quả. Nó kiểm tra quyền, việc dùng các action của bên thứ ba và cách các script được thực thi để ngăn ngừa sự cố.

Nội dung kỹ thuật (SKILL.md gốc)

Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.

GitHub Actions Advanced Skill

Expert guidance for designing, writing, debugging, and securing production-grade GitHub Actions workflows.


Detailed Guide

Read the detailed guide before executing this skill. It retains the complete procedure and reference material. Treat its safety, prerequisites, and validation requirements as mandatory. For focused work, load the relevant sections; for end-to-end work, read the guide completely.

When to Use This Skill

  • User mentions GitHub Actions, .github/workflows, CI/CD pipelines, runners, jobs, steps, or actions
  • User wants to automate builds, tests, deployments, or releases via GitHub
  • User asks about matrix builds, reusable workflows, composite actions, or self-hosted runners
  • User needs help with OIDC authentication, caching strategies, or secrets management
  • User says "my GitHub pipeline is failing" or "set up CI for my repo"
  • User asks about workflow security, hardening, or environment protection rules

When NOT to Use This Skill

  • The user is working with GitLab CI/CD → recommend gitlab-ci-patterns
  • The user is working with CircleCI, Jenkins, or other CI platforms
  • The task is purely about Docker image building without GitHub context → recommend docker-expert
  • The task is about Kubernetes deployment configuration → recommend kubernetes-architect

Security Hardening

1. Always Declare Permissions (Least Privilege)

# Workflow-level default — restrict everything
permissions:
  contents: read

jobs:
  publish:
    # Job-level override — only expand what's needed
    permissions:
      contents: write        # Only for release/publish jobs
      packages: write        # Only for container push jobs
      pull-requests: write   # Only for PR comment jobs
      id-token: write        # Only for OIDC auth jobs

2. Pin Third-Party Actions to Full Commit SHA

# ❌ UNSAFE — tag can be mutated or hijacked
- uses: actions/checkout@v4

# ✅ SAFE — commit SHA is immutable
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683  # v4.2.2

# Tool to automate SHA pinning:
# npx pin-github-action .github/workflows/*.yml
# or: pip install ratchet && ratchet pin .github/workflows/

3. Prevent Script Injection

# ❌ UNSAFE — attacker controls PR title, which gets expanded in shell
- run: echo "${{ github.event.pull_request.title }}"

# ✅ SAFE — pass through environment variable (shell doesn't evaluate it)
- env:
    PR_TITLE: ${{ github.event.pull_request.title }}
  run: echo "$PR_TITLE"

# ✅ SAFE — expressions in if: conditions are evaluated by Actions, not shell
- if: github.event.pull_request.draft == false
  run: echo "Not a draft"

Never place ${{ ... }} directly inside run: when the value can come from PR metadata, workflow inputs, repository files, matrix JSON, or earlier job outputs. Put it in env: first, validate allowlisted values where possible, and reference the shell variable with quotes.

4. Restrict pull_request_target Usage

# Only run when a maintainer adds a specific label — prevents untrusted execution
on:
  pull_request_target:
    types: [labeled]

jobs:
  validate:
    # Double-guard: check label name AND author_association
    if: |
      github.event.label.name == 'safe-to-test' &&
      (github.event.pull_request.author_association == 'COLLABORATOR' ||
       github.event.pull_request.author_association == 'MEMBER' ||
       github.event.pull_request.author_association == 'OWNER')

5. Harden with StepSecurity

# Add to every workflow — hardens runner, monitors outbound traffic
- uses: step-security/harden-runner@4d991eb9995541a0b71d1b66f1f98a5f1bef422c  # v2.11.0
  with:
    egress-policy: audit          # Start with 'audit', move to 'block' after confirming allowlist
    allowed-endpoints: >
      api.github.com:443
      registry.npmjs.org:443
      objects.githubusercontent.com:443

Limitations

  • Use this skill only when the task clearly matches the scope described above.
  • Do not treat the output as a substitute for environment-specific validation, testing, or expert review.
  • Always test reusable workflows in a feature branch before merging to main.
  • Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.
Câu hỏi thường gặp

GitHub Actions là gì?

Đây là các công cụ tự động hóa tác vụ trên GitHub, như biên dịch mã, chạy kiểm thử và phát hành phiên bản mới của dự án.

'Bảo mật' trong ngữ cảnh này nghĩa là gì?

Nghĩa là đảm bảo chỉ cấp những quyền cần thiết cho các action, các công cụ bên ngoài được dùng là đáng tin cậy, và mã không thể bị thực thi một cách độc hại.

'Reusable workflows' là gì?

Đây là các workflow bạn có thể tạo một lần và dùng lại trong nhiều dự án hoặc nhiều phần của dự án, tránh lặp lại.

Chi tiết

Mô tả gốc của tác giả

Design, debug, and harden GitHub Actions CI/CD workflows, including reusable workflows, matrix builds, self-hosted runners, OIDC authentication, caching, environments, secrets, and release automation.

repo: sickn33/agentic-awesome-skills

Độ phổ biến

Sao GitHub
48k
Vị trí xếp hạng
#4743
Giấy phép
MIT
Cập nhật
15/10/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự