Dev.to
5/12/2026
pnpm workspaces: the CI cache that survived the fix and cost me 40 minutes per build
Short summary
The author debugged a 40-minute CI build caused by misconfigured pnpm caching in GitHub Actions monorepos—could be 8 minutes with proper setup. Root cause: pnpm dynamically picks store-dir paths between runs, breaking actions/cache restoration. Solution: set fixed PNPM_STORE_PATH environment variable, configure store-dir explicitly, and use proper cache keys with hashFiles('**/pnpm-lock.yaml') to detect nested workspace changes; includes before/after workflows.
- •Monorepo CI cache failures caused by pnpm's dynamic store-dir paths between GitHub Actions runs
- •Solution: set fixed PNPM_STORE_PATH, explicitly configure store-dir, use hashFiles('**/pnpm-lock.yaml') for cache keys
- •Includes detailed before/after GitHub Actions workflows with three critical configuration fixes
Generated with AI, which can make mistakes.
Is this a good recommendation for you?


