File contents What I do
Create efficient GitHub Actions workflows
Use appropriate triggers and conditions
Implement caching for faster builds
Write matrix strategies for multi-platform testing
Handle secrets securely
Use concurrency groups to cancel outdated runs
Follow security best practices
When to use me
When creating or modifying GitHub Actions workflows.
CI Workflow
name: CI
on:
push:
branches: [main, develop]
pull_request:
branches: [main]
env:
PYTHON_VERSION: '3.11'
POETRY_VERSION: '1.5.1'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
cache: 'pip'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install black isort mypy
- name: Check formatting
run: |
black --check .
isort --check-only .
- name: Type checking
run: mypy src/
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.10', '3.11', '3.12']
os: [ubuntu-latest, macos-latest]
exclude:
- python-version: '3.12'
os: 'macos-latest'
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
- name: Install dependencies
run: |
pip install -e ".[test]"
- name: Run tests
run: pytest --cov=src --cov-report=xml
- name: Upload coverage
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.11'
uses: codecov/codecov-action@v3
with:
files: ./coverage.xml
build:
runs-on: ubuntu-latest
needs: [lint, test]
if: github.event_name == 'push'
steps:
- uses: actions/checkout@v4
- name: Build Docker image
run: docker build -t ghcr.io/${{ github.repository }}:${{ github.sha }} .
- name: Login to Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Push Docker image
run: |
docker push ghcr.io/${{ github.repository }}:${{ github.sha }}
docker tag ghcr.io/${{ github.repository }}:${{ github.sha }} ghcr.io/${{ github.repository }}:latest
docker push ghcr.io/${{ github.repository }}:latest
Security Best Practices
Use OpenID Connect for cloud authentication
Store secrets in GitHub Secrets, never in code
Pin action versions to commit SHAs
Use least-privilege for permissions
Audit dependencies with Dependabot
Scan for vulnerabilities with CodeQL
Reusable Workflows
# .github/workflows/reusable-test.yml
on:
workflow_call:
inputs:
python-version:
required: true
type: string
codecov-token:
required: false
type: string
secrets:
PYPI_TOKEN:
required: false
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ inputs.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ inputs.python-version }}
- name: Run tests
run: pytest
- name: Upload to Codecov
if: inputs.codecov-token
uses: codecov/codecov-action@v3
with:
token: ${{ inputs.codecov-token }}
1 --- 2 name: github-actions 3 description: GitHub Actions CI/CD best practices and patterns 4 license: MIT 5 --- 6 ## What I do 7 - Create efficient GitHub Actions workflows 8 - Use appropriate triggers and conditions 9 - Implement caching for faster builds 10 - Write matrix strategies for multi-platform testing 11 - Handle secrets securely 12 - Use concurrency groups to cancel outdated runs 13 - Follow security best practices 14 15 ## When to use me 16 When creating or modifying GitHub Actions workflows. 17 18 ## CI Workflow 19 ```yaml 20 name: CI 21 22 on: 23 push: 24 branches: [main, develop] 25 pull_request: 26 branches: [main] 27 28 env: 29 PYTHON_VERSION: '3.11' 30 POETRY_VERSION: '1.5.1' 31 32 concurrency: 33 group: ${{ github.workflow }}-${{ github.ref }} 34 cancel-in-progress: true 35 36 jobs: 37 lint: 38 runs-on: ubuntu-latest 39 steps: 40 - uses: actions/checkout@v4 41 42 - name: Set up Python 43 uses: actions/setup-python@v5 44 with: 45 python-version: ${{ env.PYTHON_VERSION }} 46 cache: 'pip' 47 48 - name: Install dependencies 49 run: | 50 python -m pip install --upgrade pip 51 pip install black isort mypy 52 53 - name: Check formatting 54 run: | 55 black --check . 56 isort --check-only . 57 58 - name: Type checking 59 run: mypy src/ 60 61 test: 62 runs-on: ubuntu-latest 63 strategy: 64 matrix: 65 python-version: ['3.10', '3.11', '3.12'] 66 os: [ubuntu-latest, macos-latest] 67 exclude: 68 - python-version: '3.12' 69 os: 'macos-latest' 70 steps: 71 - uses: actions/checkout@v4 72 73 - name: Set up Python ${{ matrix.python-version }} 74 uses: actions/setup-python@v5 75 with: 76 python-version: ${{ matrix.python-version }} 77 cache: 'pip' 78 79 - name: Install dependencies 80 run: | 81 pip install -e ".[test]" 82 83 - name: Run tests 84 run: pytest --cov=src --cov-report=xml 85 86 - name: Upload coverage 87 if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.11' 88 uses: codecov/codecov-action@v3 89 with: 90 files: ./coverage.xml 91 92 build: 93 runs-on: ubuntu-latest 94 needs: [lint, test] 95 if: github.event_name == 'push' 96 steps: 97 - uses: actions/checkout@v4 98 99 - name: Build Docker image 100 run: docker build -t ghcr.io/${{ github.repository }}:${{ github.sha }} . 101 102 - name: Login to Container Registry 103 uses: docker/login-action@v3 104 with: 105 registry: ghcr.io 106 username: ${{ github.actor }} 107 password: ${{ secrets.GITHUB_TOKEN }} 108 109 - name: Push Docker image 110 run: | 111 docker push ghcr.io/${{ github.repository }}:${{ github.sha }} 112 docker tag ghcr.io/${{ github.repository }}:${{ github.sha }} ghcr.io/${{ github.repository }}:latest 113 docker push ghcr.io/${{ github.repository }}:latest 114 ``` 115 116 ## Security Best Practices 117 - Use OpenID Connect for cloud authentication 118 - Store secrets in GitHub Secrets, never in code 119 - Pin action versions to commit SHAs 120 - Use least-privilege for permissions 121 - Audit dependencies with Dependabot 122 - Scan for vulnerabilities with CodeQL 123 124 ## Reusable Workflows 125 ```yaml 126 # .github/workflows/reusable-test.yml 127 on: 128 workflow_call: 129 inputs: 130 python-version: 131 required: true 132 type: string 133 codecov-token: 134 required: false 135 type: string 136 secrets: 137 PYPI_TOKEN: 138 required: false 139 140 jobs: 141 test: 142 runs-on: ubuntu-latest 143 steps: 144 - uses: actions/checkout@v4 145 - name: Set up Python ${{ inputs.python-version }} 146 uses: actions/setup-python@v5 147 with: 148 python-version: ${{ inputs.python-version }} 149 - name: Run tests 150 run: pytest 151 - name: Upload to Codecov 152 if: inputs.codecov-token 153 uses: codecov/codecov-action@v3 154 with: 155 token: ${{ inputs.codecov-token }} 156 ```
ffsshhttiikk/opencode-agents-skills/tree/main/github-actions commit 3d22642d82
Frequently asked questions How do I install the Github Actions skill? Run npx skillmds@latest add ffsshhttiikk/github-actions in your terminal (requires Node.js), paste this page's agent-chat prompt into Claude, Cursor, or any MCP-connected agent, or download the SKILL.md file and copy it into your agent's skills directory.
What does the Github Actions skill do? GitHub Actions CI/CD best practices and patterns It is listed under DevOps & Infra on SkillMD.
Is Github Actions safe to use? This skill has not completed SkillMD's automated safety review yet. SkillMD never runs a skill's scripts for you; review the SKILL.md before installing.
Which AI agents work with Github Actions? This skill is tagged as working with Claude Code, Claude.ai, OpenAI Codex. SKILL.md is an open format, so most agents that read a skills directory can load it too.
Is Github Actions free to use? Yes. Installing skills from SkillMD is free. This skill is licensed under MIT.
Who published Github Actions? ffsshhttiikk (@ffsshhttiikk) published this skill. Their other Agent Skills are listed on their SkillMD profile.