Instructions
When to Use
- Use for PR CI: lint, typecheck, test, build, cache.
- Prefer
secure-dependenciesfor audit/frozen lockfile policy. - Prefer
monorepo-toolingfor turbo task graphs first.
Add or improve GitHub Actions for a Next.js + pnpm repo.
- Workflow permissions: default
contents: readat workflow or job level; elevateid-tokenorpackagesonly where OIDC/npm publish needs it - least privilege. - Concurrency:
group: ${{ github.workflow }}-${{ github.ref }}+cancel-in-progress: trueon PR workflows to save minutes and avoid stale deploys. - Triggers:
pull_request+pushtomain; optionalworkflow_dispatch. - pnpm:
pnpm/action-setup+ cache viapnpm store pathor built-in cache; alwayspnpm install --frozen-lockfilein CI. - Jobs:
lint→typecheck→test→buildwithneedswhere parallel is impossible; optional parallelauditjob (pnpm audit --audit-level=highor org policy) - seesecure-dependencies. - Next build: set
NODE_OPTIONSonly if required; artifactnext buildtrace for failures optional. - Fork PRs:
pull_request_targetavoided unless user understands risk; defaultpull_request. - Node version: pin
22or20LTS withactions/setup-nodeand matchenginesinpackage.json.
Outcomes
- Workflow file path + YAML body or diff against existing workflow.
Output Rules
Fenced yaml for workflow; mention required secrets by name only.
Scope and boundaries
- In scope: CI YAML, cache, job graph.
- Out of scope: self-hosted runner fleet design, Kubernetes deploy.
Safety
- Never echo
GITHUB_TOKENpatterns; use${{ secrets.* }}placeholders.
Troubleshooting
- pnpm frozen-lockfile fails: align CI with lockfile version from contributor.
- OOM on build: split build job memory or enable standalone output only if user wants.
Related skills
secure-dependencies- lockfile and audit in CImonorepo-tooling- turbo pipelines in Actionsdependency-migrations- major upgrade gates
GitHub: https://github.com/bh611627/skillcodex/tree/main/skills/github-actions-ci/SKILL.md
npm: https://www.npmjs.com/package/@skillcodex/skills