/cicd-tooling-skills:github-actions-single-repo-workflowsfrom cicd-tooling-skills
Authors and troubleshoots GitHub Actions workflow YAML for single-repo CI/CD pipelines — triggers, jobs/steps, matrix builds, caching with actions/cache, and local composite actions.
Ships in cicd-tooling-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Most repos' CI needs are served by workflow YAML that lives entirely
within that repo under .github/workflows/, defining its own triggers,
jobs, and steps. This skill covers the concrete GitHub Actions mechanics
for that single-repo case — trigger syntax (on:), job/step structure,
matrix builds, actions/cache, and composite actions defined locally in
.github/actions/ for within-repo reuse — as distinct from the
organization-wide reusable-workflow pattern covered in
github-actions-centralized-reusable-workflows.
Generic pipeline-design concepts (stage ordering, quality gates, caching
philosophy) are covered vendor-neutrally in
ci-cd-pipeline-design;
this skill focuses on GitHub Actions' actual YAML syntax and runner
behavior.
.github/workflows/*.yml file is failing and needs debugging.actions/cache, concurrency
cancellation, or splitting a monolithic job into parallel jobs with
needs:..github/actions/.ubuntu-latest,
windows-latest, macos-latest) require no setup; self-hosted runners
need registration and their own OS/tooling patching (Settings → Actions
→ Runners).${{ }}) and GitHub's built-in
contexts (github.*, secrets.*, matrix.*, needs.*).Scope triggers precisely. Use paths:/paths-ignore: in a
monorepo so unrelated changes don't trigger a full pipeline, and add
concurrency so superseded runs on the same ref are cancelled:
name: ci
on:
pull_request:
branches: [main]
paths: ["src/**", "package*.json"]
push:
branches: [main]
concurrency:
group: ci-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
Use strategy.matrix for cross-version/cross-OS testing, and
fail-fast: false when you want every matrix leg's result even if one
fails early:
jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
node: ["18", "20", "22"]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with: { node-version: ${{ matrix.node }}, cache: "npm" }
- run: npm ci
- run: npm test
Cache dependencies keyed on the lockfile hash, with a restore-key fallback for partial cache hits:
- uses: actions/cache@v4
with:
path: ~/.cache/pip
key: pip-${{ runner.os }}-${{ hashFiles('requirements.txt') }}
restore-keys: |
pip-${{ runner.os }}-
Prefer the language-specific setup action's built-in cache: input
(actions/setup-node@v4 with cache: "npm",
actions/setup-python@v5 with cache: "pip") over hand-rolled
actions/cache where available — it's pre-wired to the right paths and
keys.
Shard slow test suites across matrix legs rather than running the full suite serially in one job:
strategy:
matrix:
shard: [1, 2, 3, 4]
steps:
- run: npm test -- --shard=${{ matrix.shard }}/4
Extract repeated step sequences into a local composite action
under .github/actions/<name>/action.yml when the same steps recur
across jobs within this repo — this is the single-repo analog of a
shared library, scoped to one repo:
# .github/actions/setup-toolchain/action.yml
name: "Setup toolchain"
description: "Checks out code and installs Node + cached deps"
runs:
using: "composite"
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with: { node-version: "20", cache: "npm" }
- run: npm ci
shell: bash
Consumed within the same repo's workflow as:
steps:
- uses: ./.github/actions/setup-toolchain
- run: npm test
Gate deploy jobs with environment: protection rules rather than
a manual convention, and separate the deploy job from the test/build
job via needs: so a deploy can be re-run without re-running tests:
deploy-staging:
needs: build
runs-on: ubuntu-latest
environment: { name: staging }
steps:
- run: ./deploy.sh staging ${{ github.sha }}
Pin every third-party action to a full commit SHA or, at minimum, a
major version tag (actions/checkout@v4, not @main or an unpinned
floating tag) — see the pitfalls below for why this matters more than
it looks.
Surface structured results, not just exit codes: upload JUnit/
coverage artifacts and use actions/upload-artifact@v4 so a failure is
diagnosable from the PR without re-running locally.
actions/checkout@8459de2...) or major-version tag,
and update deliberately via Dependabot/Renovate rather than tracking
@main — an upstream action change can silently alter your pipeline's
behavior otherwise.permissions: at the workflow or job level to scope the
GITHUB_TOKEN down from its (sometimes broad) default — e.g.
permissions: { contents: read } for a job that only builds/tests and
never needs to push or open issues.needs: chains.if: always() deliberately and sparingly on cleanup/notification
steps — it's easy to accidentally suppress a should-have-failed job by
overusing continue-on-error alongside it..github/actions/); when it's
copy-pasted across repos, that's the trigger to build an org-level
reusable workflow instead — see
github-actions-centralized-reusable-workflows.pull_request_target with extreme caution — it runs with access
to secrets and the base repo's permissions even for a fork's PR; never
check out and execute a fork's untrusted code under pull_request_target
without explicit, reviewed guardrails.Symptom: A required check named test passes even though one
matrix leg actually failed.
Fix: With fail-fast: false, GitHub still reports the overall job
as failed if any matrix leg fails — but if branch protection points at
an individual matrix leg's generated check name instead of the job as
a whole, adding/removing a matrix entry silently changes which check
names exist; point required checks at a summary/gate job instead
(mirroring the gate-summary pattern in
secure-cicd-gates).
Symptom: A workflow that ran safely for months suddenly executes
unexpected code or exfiltrates a secret after a third-party action
update.
Fix: This is the risk of tracking @main/@latest on a third-party
action; pin to a full commit SHA (most defensible) or at least a
specific version tag, and review action source before pinning to a new
major version.
Symptom: actions/cache restores a stale node_modules and tests
pass in CI but the same code fails when run fresh locally (or vice
versa).
Fix: Key the cache on the lockfile hash
(hashFiles('package-lock.json')), not a static string or branch name,
so a dependency change invalidates the cache instead of silently reusing
stale content.
Symptom: pull_request_target workflow checks out and runs a
fork's PR branch code, and a malicious PR exfiltrates repo secrets.
Fix: Never combine pull_request_target with checking out and
executing the PR head's untrusted code; if you need secrets available
to a fork PR's workflow, keep the trusted workflow on pull_request_target
narrow (e.g. only to post a comment) and run the untrusted build under
plain pull_request (no secrets) instead.
Symptom: Two pushes to the same branch in quick succession both run
the full pipeline, wasting runner minutes and creating confusing
out-of-order status updates.
Fix: Add concurrency: { group: ci-${{ github.ref }}, cancel-in-progress: true } so a newer push cancels the superseded in-flight run.
Scenario: A single Python service repo needs CI across three Python versions with sharded tests, dependency caching, and a composite action that both the CI and a separate nightly workflow reuse for environment setup.
.github/actions/setup-python-env/action.yml:
name: "Setup Python env"
description: "Checkout + Python + cached pip deps"
inputs:
python-version:
required: true
runs:
using: "composite"
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ inputs.python-version }}
cache: "pip"
- run: pip install -r requirements.txt -r requirements-dev.txt
shell: bash
.github/workflows/ci.yml:
name: ci
on:
pull_request:
branches: [main]
push:
branches: [main]
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.10", "3.11", "3.12"]
shard: [1, 2]
steps:
- uses: ./.github/actions/setup-python-env
with: { python-version: ${{ matrix.python-version }} }
- run: pytest --shard-id=${{ matrix.shard }} --num-shards=2 --junitxml=reports/junit.xml
- uses: actions/upload-artifact@v4
if: always()
with:
name: junit-${{ matrix.python-version }}-${{ matrix.shard }}
path: reports/junit.xml
gate:
needs: test
if: always()
runs-on: ubuntu-latest
steps:
- run: |
if [[ "${{ contains(needs.*.result, 'failure') }}" == "true" ]]; then
echo "test matrix had a failure"; exit 1
fi
Branch protection requires only the gate job, so adding/removing matrix
entries in test never requires updating the required-checks list.
workflow_call once it's duplicated across multiple repos.gate job's blocking rules and adding security scan steps.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
github-actions, workflows, ci-cd, single-repo, composite-actions, matrix-builds
13 skills in this plugin
/aws-codepipeline-and-codedeployDesigns AWS CodePipeline stage/action structure and integrates it with CodeDeploy deployment groups and appspec.yml for EC2/on-prem, ECS, or Lambda deploys. Use when the user asks to "set up CodePipeline," "add a CodeDeploy deployment group," "write an appspec.yml," "wire CodePipeline to CodeDeploy," "troubleshoot a stuck/failed CodePipeline action," or "add a manual approval action before an AWS deploy."
/azure-pipelines-yaml-and-multi-stageDesigns Azure Pipelines YAML (azure-pipelines.yml), multi-stage pipelines with environments/approvals, templates for reuse across repos, and self-hosted vs. Microsoft-hosted agent pools. Use when the user asks to "set up Azure Pipelines," "write an azure-pipelines.yml," "add a multi-stage pipeline with approvals," "create a reusable pipeline template," "configure a self-hosted agent pool," or "troubleshoot a stuck/failed Azure DevOps pipeline run."
/bamboo-pipeline-yaml-and-java-specsAuthors Atlassian Bamboo pipeline definitions using either Bamboo Specs (Java DSL, compiled and run to create/update a plan) or Bamboo's YAML specs format, covering plan/job/stage structure and how a Specs definition links to and updates a live Bamboo plan. Use when the user asks to "write a Bamboo Specs plan," "convert our Bamboo plan to code," "add a stage/job to a Bamboo build," "use Bamboo YAML specs," or "troubleshoot a Bamboo Specs plan not updating the linked plan."
npx claudepluginhub selvarajmurugesan90/ops-engineering-skills --plugin cicd-tooling-skillsOther plugins' skills for the same job