Description
Description:
Currently the cache key is always the following format node-cache-{platform}-{packageManager}-{fileHash(lockfile)}
I'd like a way to add a prefix between the packageManager and the file hash like node-cache-{platform}-{packageManager}-{cachePrefix}-{fileHash(lockfile)}
Justification:
We work in a monorepo with yarn workspaces. In order to scope our yarn installs and cache, we use yarn workspaces focus
with cache-dependency-path
pointing to yarn.workspace.lock
from https://github.com/MaintainX/yarn-plugin-workspace-lockfile
This means we have multiple workflows all saving and restoring caches for different file hashes.
Because we use yarn3, setup-node uses fallback restore keys.
Which means it frequently happens that 1 workflow will fallback on the cache from a totally different set of lockfiles, run yarn effectively download what's missing and grow the cache and save that cache back.
Somewhat related #1120
What happens is that our caches are constantly growing, over time including the whole monorepo's dependencies and more.
We tried to mitigate this by manually creating caches on push to master using actions/cache/save
instead of setup-node so we wouldn't restore the cache making it a "fresh" cache.
Having a cache prefix that we control, we could give a semantic name for scopes of the monorepo allowing to avoid workflows to cross restore caches for a different yarn workspaces focus
command
Are you willing to submit a PR?
Yes I'm willing to open a PR if this suggestion is accepted