Reuse package manager downloads between runs.
Section: Speed and portability
Cache npm dependencies in GitHub Actions
yaml
yaml
- uses: actions/setup-node@v4
with:
node-version: 20
cache: npmExplanation
Prefer built-in setup action caching when available because it is simpler and less error-prone.
Learn the surrounding workflow
Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.
Related commands
Same sheet · prioritizing Speed and portability
GitLab cache vs artifacts
Use cache for dependencies and artifacts for outputs.
Upload build artifacts
Publish files from one job for later download or deploy.
GitHub reusable workflow
Call a shared workflow from another repository or workflow file.