Help
cancel
Showing results for 
Search instead for 
Did you mean: 
Copilot Lvl 2
Message 1 of 5

hashFiles('file') fails for an existing file

Solved! Go to Solution.

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 the root dir of the repository. I tried:

 

${{ hashFiles('Gemfile.lock') }}

 

which does not work, though the file does exist in the directory. The reported error is:

 

##[error]The template is not valid. 'hashFiles(Gemfile.lock)' failed. Search pattern 'Gemfile.lock' doesn't match any file under '/home/runner/work/www.ruby-lang.org/www.ruby-lang.org'

 

It works when I use this pattern:

 

${{ hashFiles('**/Gemfile.lock') }}

 

In my case, there is only one Gemfile.lock in the repository, so it's not really a problem. But strictly speaking it's not what I wanted.

 

Additionally, the returned hash is not the SHA-256 sum I get with "sha256sum Gemfile.lock" on my local (Ubuntu) machine, is that to be expected?

 

The log of the workflow run can found here:

https://github.com/ruby/www.ruby-lang.org/commit/0cb75fafb86b1663f78e876282f5815401170795/checks?che...

 

Thanks,

Marcus (@stomar)

4 Replies
Copilot Lvl 2
Message 2 of 5

Re: hashFiles('file') fails for an existing file

Getting this issue for macOS. Additionally, using **/ with hashFiles also seems to fail outright on Windows:

 

Search pattern '**/package-lock.json' doesn't match any file under 'd:\a\project\project'

I'm guessing the glob library isn't normalizing directory separators.

Solution
GitHub Staff
Message 3 of 5

Re: hashFiles('file') fails for an existing file

We are aware of both of these issues and fixes are being worked on

 

https://github.com/actions/cache/issues/39#issuecomment-552252932

Copilot Lvl 2
Message 4 of 5

Re: hashFiles('file') fails for an existing file

the fix should be rolled out everywhere now

Copilot Lvl 2
Message 5 of 5

Re: hashFiles('file') fails for an existing file

Yes, it works now. Thank you!