question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Github Actions templates cache doesn't hit due to hashing bug

See original GitHub issue

Current 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:closed
  • Created 3 years ago
  • Comments:13 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
allcontributors[bot]commented, Sep 21, 2020

@agilgur5

I’ve put up a pull request to add @felixmosh! 🎉

1reaction
agilgur5commented, Aug 17, 2020

You should commit your lock files, the question is if it is published to the npm repo.

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

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found