Create GitHub Actions workflow files
✓Works with OpenClaudeYou are a DevOps engineer setting up CI/CD pipelines. The user wants to create and configure GitHub Actions workflow files for automated testing, building, and deployment.
What to check first
- Verify the
.github/workflows/directory exists in the repository root—create it if missing - Check the repository has write permissions and the user has admin or maintainer access to enable Actions
- Review the target branch protection rules to ensure workflows can run on pull requests
Steps
- Create the
.github/workflows/directory structure at the repository root (not nested insidesrc/or other subdirectories) - Create a workflow file with
.ymlor.yamlextension—e.g.,.github/workflows/ci.yml - Define the
namefield to label the workflow in the Actions UI - Set
on:trigger events (e.g.,push,pull_request,schedule) with specific branches usingbranches:key - Define
jobs:with a unique job identifier andruns-on:specifying the runner (e.g.,ubuntu-latest,macos-latest) - Add
steps:withuses:for pre-built actions andrun:for shell commands, includingactions/checkout@v4as the first step - Use
env:at workflow or step level to inject environment variables - Commit the workflow file to the default branch—GitHub automatically enables it
Code
name: CI Pipeline
on:
push:
branches:
- main
- develop
pull_request:
branches:
- main
env:
NODE_VERSION: '18'
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16.x, 18.x, 20.x]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Run linter
run: npm run lint
- name: Run tests
run: npm test -- --coverage
- name: Upload coverage
uses: codecov/codecov-action@v3
with:
files: ./coverage/lcov.info
fail_ci_if_error: false
build:
runs-on: ubuntu-latest
needs: test
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'
- name: Install dependencies
run: npm ci
Note: this example was truncated in the source. See the GitHub repo for the latest full version.
Common Pitfalls
- Treating this skill as a one-shot solution — most workflows need iteration and verification
- Skipping the verification steps — you don't know it worked until you measure
- Applying this skill without understanding the underlying problem — read the related docs first
When NOT to Use This Skill
- When a simpler manual approach would take less than 10 minutes
- On critical production systems without testing in staging first
- When you don't have permission or authorization to make these changes
How to Verify It Worked
- Run the verification steps documented above
- Compare the output against your expected baseline
- Check logs for any warnings or errors — silent failures are the worst kind
Production Considerations
- Test in staging before deploying to production
- Have a rollback plan — every change should be reversible
- Monitor the affected systems for at least 24 hours after the change
Related DevOps & CI/CD Skills
Other Claude Code skills in the same category — free to download.
GitLab CI Setup
Create .gitlab-ci.yml pipeline configuration
Jenkins Pipeline
Generate Jenkinsfile for CI/CD
Deploy Script
Create deployment scripts for various platforms
Env Manager
Manage environment variables across environments
Infrastructure as Code
Generate Terraform/Pulumi configurations
Auto Release
Set up automated releases with semantic versioning
Rollback Script
Create rollback procedures and scripts
Blue-Green Deploy
Configure blue-green deployment strategy
Want a DevOps & CI/CD skill personalized to YOUR project?
This is a generic skill that works for everyone. Our AI can generate one tailored to your exact tech stack, naming conventions, folder structure, and coding patterns — with 3x more detail.