Problem
npm install runs on every workflow invocation, downloading all dependencies from scratch. This adds ~15-30s to every run and wastes bandwidth.
Expected behavior
Use GitHub Actions cache to persist node_modules between runs.
Implementation notes
- Use
actions/cache with package-lock.json hash as the cache key
- Alternatively, use
actions/setup-node with cache: npm (simpler)
- Example:
- uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
- Consider pre-building and bundling the action so no install step is needed at all (esbuild/ncc)
@vercel/ncc can compile the entire action into a single file — eliminates npm install entirely
Priority
P2 — Nice optimization but not blocking functionality.
Problem
npm installruns on every workflow invocation, downloading all dependencies from scratch. This adds ~15-30s to every run and wastes bandwidth.Expected behavior
Use GitHub Actions cache to persist
node_modulesbetween runs.Implementation notes
actions/cachewithpackage-lock.jsonhash as the cache keyactions/setup-nodewithcache: npm(simpler)@vercel/ncccan compile the entire action into a single file — eliminates npm install entirelyPriority
P2 — Nice optimization but not blocking functionality.