hashFiles('file') fails for an existing file


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:



Marcus (@stomar)


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.

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


1 Like

the fix should be rolled out everywhere now

1 Like

Yes, it works now. Thank you!