GitHub Actions pnpm CI
Use This Shape
Install the bundled assets as the default CI shape:
.github/actions/prepare/action.ymlfromassets/prepare-action.yml.github/workflows/lint.ymlfromassets/workflows/lint.yml.github/workflows/test.ymlfromassets/workflows/test.yml.github/workflows/typecheck.ymlfromassets/workflows/typecheck.yml.github/workflows/build.ymlfromassets/workflows/build.yml.github/dependabot.ymlfromassets/dependabot.yml
Rules
- Keep remote actions pinned to full commit SHAs with the upstream semver tag in the same-line comment, for example
# v6.0.2. - Use
pnpm/action-setupwithout aversioninput so it readspackageManagerfrompackage.json. - Require
packageManagerto include pnpm integrity, for examplepnpm@10.33.4+sha512.... - Enable pnpm store caching by default with
actions/setup-nodecache: pnpm. - Cache only the pnpm store; do not cache
node_modules. - Use
cache-dependency-path: pnpm-lock.yamlfor single-package repos. - For workspaces, use both
pnpm-lock.yamlandpnpm-workspace.yamlincache-dependency-path. - Install with
pnpm install --frozen-lockfile. - Keep CI token permissions at
contents: readunless a job truly writes to GitHub. - Add
concurrencyto every workflow. - Add Dependabot for
github-actionsonly.
Adaptation
- If a script is missing, do not invent a command silently; first inspect
package.jsonand use the closest existing script. - If tests need Playwright, add
pnpm exec playwright install --with-deps chromiumbefore the test command. - If a build needs dummy env vars, copy the repo-local pattern and keep secrets out of caches.
- If the repo already has user changes, preserve them and patch only the CI files needed.
Validation
Run these after installing or updating the files:
pnpm exec actionlint
git diff --check
If actionlint is not available in the repo, use pnpm dlx actionlint or the repo's existing actionlint command.