CICD-389 · Shared dependency caching
Encyclopedia · Monorepo and large-scale build engineering · All snippets
Previous · CICD-388 · Next · CICD-390
1. Where it fits
- Placement .github/workflows/ci.yml step.
- Prerequisites trusted checkout with the base ref fetched and pinned package manager or build tool.
- Platforms github-actions.
2. Copy the snippet
yaml
uses: actions/setup-node@v4
with:
node-version: "22"
cache: pnpm
cache-dependency-path: pnpm-lock.yaml3. How it works
This invokes an action at step scope or a reusable workflow at job scope. The reference and declared inputs must match that contract.
4. Verify the result
Activate the pinned pnpm version first. The cache contains package downloads rather than installed workspace outputs.
Validation syntax-validated (YAML parse). Status definitions.