Hi,
There is a recommendation in the readme (https://github.com/actions/cache/blob/main/examples.md#node---yarn, https://github.com/actions/cache/blob/main/examples.md#using-multiple-systems-and-npm-config) for a NPM package to use key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} as a key.
The usage of glob may not work due to the fact that there are NPM packages which publish their yarn.lock/package-lock.json.
This means that the key that was generated at the beginning of the work flow will be different from the one that will be generated at the end. (due to the fact that at the beginning node_modules is empty => key will be a hash of the lib's lock file, but at the end, it will make a hash of all lock files including the one that are inside node_modules).
For more info, AllanChain/blog#98
jaredpalmer/tsdx#799 (comment)
Hi,
There is a recommendation in the readme (https://github.com/actions/cache/blob/main/examples.md#node---yarn, https://github.com/actions/cache/blob/main/examples.md#using-multiple-systems-and-npm-config) for a NPM package to use
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}as a key.The usage of glob may not work due to the fact that there are NPM packages which publish their
yarn.lock/package-lock.json.This means that the key that was generated at the beginning of the work flow will be different from the one that will be generated at the end. (due to the fact that at the beginning
node_modulesis empty => key will be a hash of the lib's lock file, but at the end, it will make a hash of all lock files including the one that are insidenode_modules).For more info, AllanChain/blog#98
jaredpalmer/tsdx#799 (comment)