Interview Prep/GitHub Actions/Caching, Artifacts, Builds & Scans

A cache restores but the build is still slow and reinstalls everything.

IntermediateTroubleshootingCaching, Artifacts, Builds & Scans
Answer

Likely causes → Cached the wrong path (node_modules with npm ci, which deletes it), path mismatch between OS (~/.npm vs %AppData%), restore-key hit an old cache with mostly stale content, or the tool uses a different cache directory (Yarn Berry, pnpm store).

Diagnose → npm config get cache, pnpm store path, check restored size in logs.

Fix → Cache the tool's real cache path, or use setup-node's cache: pnpm.

Prevent → Measure step durations with and without cache.

All GitHub Actions questions Roadmap: GitHub Actions

More on Caching, Artifacts, Builds & Scans