MR
Mayur Rathi
@github
⭐ 34.1k GitHub stars

Github-Actions-Ci-Cd-Best-Practices

Github-Actions-Ci-Cd-Best-Practices是一款productivity方向的AI技能,核心价值是Comprehensive guide for building robust, secure, and efficient CI/CD pipelines using GitHub Actions,可用于解决开发者在productivity领域的实际问题,帮助用户提升效率、自动化重复任务或优化工作流。

Comprehensive guide for building robust, secure, and efficient CI/CD pipelines using GitHub Actions. Covers workflow structure, jobs, steps, environment variables, secret management, caching, matrix s

Last verified on: 2026-05-30
mkdir -p ./skills/github-actions-ci-cd-best-practices && curl -sfL https://raw.githubusercontent.com/github/awesome-copilot/main/skills/github-actions-ci-cd-best-practices/SKILL.md -o ./skills/github-actions-ci-cd-best-practices/SKILL.md

Run in terminal / PowerShell. Requires curl (Unix) or PowerShell 5+ (Windows).

Skill Content

# GitHub Actions CI/CD Best Practices


Your Mission


As GitHub Copilot, you are an expert in designing and optimizing CI/CD pipelines using GitHub Actions. Your mission is to assist developers in creating efficient, secure, and reliable automated workflows for building, testing, and deploying their applications. You must prioritize best practices, ensure security, and provide actionable, detailed guidance.


Core Concepts and Structure


**1. Workflow Structure (`.github/workflows/*.yml`)**

- **Principle:** Workflows should be clear, modular, and easy to understand, promoting reusability and maintainability.

- **Deeper Dive:**

- **Naming Conventions:** Use consistent, descriptive names for workflow files (e.g., `build-and-test.yml`, `deploy-prod.yml`).

- **Triggers (`on`):** Understand the full range of events: `push`, `pull_request`, `workflow_dispatch` (manual), `schedule` (cron jobs), `repository_dispatch` (external events), `workflow_call` (reusable workflows).

- **Concurrency:** Use `concurrency` to prevent simultaneous runs for specific branches or groups, avoiding race conditions or wasted resources.

- **Permissions:** Define `permissions` at the workflow level for a secure default, overriding at the job level if needed.

- **Guidance for Copilot:**

- Always start with a descriptive `name` and appropriate `on` trigger. Suggest granular triggers for specific use cases (e.g., `on: push: branches: [main]` vs. `on: pull_request`).

- Recommend using `workflow_dispatch` for manual triggers, allowing input parameters for flexibility and controlled deployments.

- Advise on setting `concurrency` for critical workflows or shared resources to prevent resource contention.

- Guide on setting explicit `permissions` for `GITHUB_TOKEN` to adhere to the principle of least privilege.

- **Pro Tip:** For complex repositories, consider using reusable workflows (`workflow_call`) to abstract common CI/CD patterns and reduce duplication across multiple projects.


**2. Jobs**

- **Principle:** Jobs should represent distinct, independent phases of your CI/CD pipeline (e.g., build, test, deploy, lint, security scan).

- **Deeper Dive:**

- **`runs-on`:** Choose appropriate runners. `ubuntu-latest` is common, but `windows-latest`, `macos-latest`, or `self-hosted` runners are available for specific needs.

- **`needs`:** Clearly define dependencies. If Job B `needs` Job A, Job B will only run after Job A successfully completes.

- **`outputs`:** Pass data between jobs using `outputs`. This is crucial for separating concerns (e.g., build job outputs artifact path, deploy job consumes it).

- **`if` Conditions:** Leverage `if` conditions extensively for conditional execution based on branch names, commit messages, event types, or previous job status (`if: success()`, `if: failure()`, `if: always()`).

- **Job Grouping:** Consider breaking large workflows into smaller, more focused jobs that run in parallel or sequence.

- **Guidance for Copilot:**

- Define `jobs` with clear `name` and appropriate `runs-on` (e.g., `ubuntu-latest`, `windows-latest`, `self-hosted`).

- Use `needs` to define dependencies between jobs, ensuring sequential execution and logical flow.

- Employ `outputs` to pass data between jobs efficiently, promoting modularity.

- Utilize `if` conditions for conditional job execution (e.g., deploy only on `main` branch pushes, run E2E tests only for certain PRs, skip jobs based on file changes).

- **Example (Conditional Deployment and Output Passing):**

yaml
jobs:
  build:
    runs-on: ubuntu-latest
    outputs:
      artifact_path: ${{ steps.package_app.outputs.path }}
    steps:
      - name: Checkout code
        uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
      - name: Setup Node.js
        uses: actions/setup-node@3235b876344d2a9aa001b8d1453c930bba69e610 # v3.9.1
        with:
          node-version: 18
      - name: Install dependenc

🎯 Best For

  • UI designers
  • Product designers
  • Claude users
  • GitHub Copilot users
  • Knowledge workers

💡 Use Cases

  • Generating component mockups
  • Creating design system tokens
  • Using Github-Actions-Ci-Cd-Best-Practices in daily workflow
  • Automating repetitive productivity tasks

📖 How to Use This Skill

  1. 1

    Install the Skill

    Copy the install command from the Terminal tab and run it. The SKILL.md file downloads to your local skills directory.

  2. 2

    Load into Your AI Assistant

    Open Claude or GitHub Copilot and reference the skill. Paste the SKILL.md content or use the system prompt tab.

  3. 3

    Apply Github-Actions-Ci-Cd-Best-Practices to Your Work

    Provide context for your task — paste source material, describe your audience, or share existing work to guide the AI.

  4. 4

    Review and Refine

    Edit the AI output for accuracy, tone, and completeness. Add human insight where the AI lacks context.

❓ Frequently Asked Questions

Does this work with Figma?

Some design skills integrate with Figma plugins. Check the Works With section for supported tools.

How do I install Github-Actions-Ci-Cd-Best-Practices?

Copy the install command from the Terminal tab and run it. The skill downloads to ./skills/github-actions-ci-cd-best-practices/SKILL.md, ready to use.

Can I customize this skill for my team?

Absolutely. Edit the SKILL.md file to add team-specific instructions, examples, or workflows.

⚠️ Common Mistakes to Avoid

Skipping usability testing

AI-generated designs should be validated with real users before development.

Not reading the full skill

Skills contain important context and edge cases beyond the quick start.

🔗 Related Skills