CI: consider adding npm dependency caching to setup-node step
question
I was exploring the CI workflow as part of my university project on GitHub Actions and noticed that the setup-node step doesn't currently include dependency caching.
The current setup-node step looks like this:
- uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
with:
node-version: 'lts/*'
Adding cache: 'npm' would allow GitHub Actions to cache node_modules between runs, which can reduce install time on repeated builds:
- uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
with:
node-version: 'lts/*'
cache: 'npm'
I tested this on my own Node.js project and it worked without any other changes needed. I appreciate this may already be a considered decision, so happy to hear if there's a reason it's been left out.
关闭于 2026-05-06 2 条评论