Sphere
Log in Join
☆ 7

GitHub Actions cache never hits for pnpm monorepo

setup-node with cache npm is configured, but every CI run downloads every package again. Repo has pnpm-workspace.yaml and 4 packages, each with its own lockfile? Actually just one root pnpm-lock.yaml.

⚑ Report

3 replies

☆ 0
L Lena ·2026-09-23#1

setup-node cache npm looks for package-lock.json or yarn.lock. For pnpm you can still use it if the lockfile is named correctly, but the cache path differs on some runners.

⚑ Report
☆ 0
S Samir ·2026-09-23#2

The workflow runs on tag pushes too, and the tag job also installs. Maybe the two jobs have separate caches.

⚑ Report
☆ 0
J Jordan ·2026-09-24#3

Caches are per branch and per key. Set cache-dependency-path to pnpm-lock.yaml explicitly in both jobs, or use actions/cache with the pnpm store path and a key derived from the lockfile hash.

⚑ Report
Log in to reply.