Github Actions templates cache doesn't hit due to hashing bug
See original GitHub issueCurrent Behavior
Due to the fact that this line has a glob, it will create a wrong key!
Explanation, when the workflow starts it doesn’t have any node_modules, therefore hashFiles('**/yarn.lock')
will use only the package’s yarn.lock
(as expected), but at the end of the flow, node_modules are installed, hashFiles('**/yarn.lock')
will contain all yarn.lock
files from node_modules as well, therfore hashFiles('**/yarn.lock')
will save the cache on a different key.
Expected behavior
It should relay only on the package’s yarn.lock
file.
Suggested solution(s)
Remove the glob from this line https://github.com/formium/tsdx/blob/master/templates/basic/.github/workflows/main.yml#L20.
Additional context
Based on the research that @AllanChain did, https://github.com/AllanChain/blog/issues/98
Your environment
Software | Version(s) |
---|---|
TSDX | |
TypeScript | |
Browser | |
npm/Yarn | |
Node | |
Operating System |
Issue Analytics
- State:
- Created 3 years ago
- Comments:13 (4 by maintainers)
Top Results From Across the Web
Github Actions templates cache doesn't hit due to hashing bug
Explanation, when the workflow starts it doesn't have any node_modules, therefore hashFiles('**/yarn.lock') will use only the package's yarn.
Read more >Post cache failed with "The template is not valid. hashFiles ...
Customer reports that the post cache action on macos was failed randomly result in job cancellation. There is an example workflow run which ......
Read more >hashFiles() couldn't finish within 120 seconds. #1840 - GitHub
I have the same problem when using the cache action to cache Maven artifacts. I have 320 pom.xml files "only", in my repository....
Read more >hashFiles('file') fails for an existing file #25559 - GitHub
Hi,. this is my first post, I hope it's ok. For caching I need a hash of my Gemfile.lock, which is located in...
Read more >hashFiles function returns nothing instead of hash of the file ...
Create an action that attempts to cache the NPM cache folder with the example provided in the Github documentation; See that no hash...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@agilgur5
I’ve put up a pull request to add @felixmosh! 🎉
Yes, that’s what I was talking about. The NPM link I added says they cannot be published, so the inclusion of lockfiles in publishes is specific to Yarn