Cache keys need the lockfile hash, and a restore-key without it
A cache keyed only on the OS never updates. A cache keyed on the lockfile hash misses entirely when one dependency changes. Use both.
- uses: actions/cache@v4
with:
path: ~/.local/share/pnpm/store
key: pnpm-${{ runner.os }}-${{ hashFiles('pnpm-lock.yaml') }}
restore-keys: pnpm-${{ runner.os }}-An exact hit is free. A miss restores the most recent cache for the OS, so the install only fetches the delta.
ci