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.

hashFiles() does not work for valid patterns

See original GitHub issue

The expected behavior is that all three of the following steps pass on all platforms:

- name: Cache **/README.md
  uses: actions/cache@preview
  with:
    path: .
    key: test-${{ runner.os }}-${{ hashFiles('**/README.md') }}
  continue-on-error: true

- name: Cache README.md
  uses: actions/cache@preview
  with:
    path: .
    key: test-${{ runner.os }}-${{ hashFiles('README.md') }}
  continue-on-error: true

- name: Cache *README.md
  uses: actions/cache@preview
  with:
    path: .
    key: test-${{ runner.os }}-${{ hashFiles('*README.md') }}
  continue-on-error: true

But right now hashFiles(README.md) and hashFiles(*README.md) fails macOS:

2019-11-02T18:08:19.8057240Z ##[error]The template is not valid. 'hashFiles(README.md)' failed. Search pattern 'README.md' doesn't match any file under '/Users/runner/runners/2.160.0/work/github-actions-hashfiles-test/github-actions-hashfiles-test'
2019-11-02T18:08:19.8346580Z ##[error]The template is not valid. 'hashFiles(*README.md)' failed. Search pattern '*README.md' doesn't match any file under '/Users/runner/runners/2.160.0/work/github-actions-hashfiles-test/github-actions-hashfiles-test'

And hashFiles(README.md) and hashFiles(**/README.md) fails Windows:

2019-11-02T18:09:01.2005576Z ##[error]The template is not valid. 'hashFiles(**/README.md)' failed. Search pattern '**/README.md' doesn't match any file under 'd:\a\github-actions-hashfiles-test\github-actions-hashfiles-test'
2019-11-02T18:09:01.2212553Z ##[error]The template is not valid. 'hashFiles(README.md)' failed. Search pattern 'README.md' doesn't match any file under 'd:\a\github-actions-hashfiles-test\github-actions-hashfiles-test'

See example repo: https://github.com/poiru/github-actions-hashfiles-test And run: https://github.com/poiru/github-actions-hashfiles-test/commit/23dcdc7705d1660ba845291f744dd9b4a9157458/checks?check_suite_id=293065410

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:2
  • Comments:13 (5 by maintainers)

github_iconTop GitHub Comments

18reactions
joshmgrosscommented, Nov 3, 2019

hashFiles will be updated soon so that relative paths are rooted at github.workspace, which will allow hashFiles('README.md').

/ not working on Windows is definitely a bug, ideally / would work on all platforms so that you wouldn’t need a runner.separator variable.

3reactions
stomarcommented, Nov 10, 2019

@joshmgross The current hashFiles documentation states: “Returns a single hash for the set of files that matches the path pattern. The path is relative to the GITHUB_WORKSPACE directory […]” (as of 2019-11-09).

However, hashFiles('Gemfile.lock') does not work at the moment. Documentation error or do I misunderstand something?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Post cache failed with "The template is not valid. hashFiles ...
Up to today, I am still having this error popping randomly (only on Mac OS machines), while Linux/Windows machines are working fine. image....
Read more >
How do I cache steps in GitHub actions? - Stack Overflow
Any changes you make in one step persist on disk into the next steps for that workflow run. Of course, this will not...
Read more >
7 Github Actions Tricks I Wish I Knew Before I Started
Here are 7 tricks with github actions that changed my life (or at least my CI/CD pipeline). These tricks helped me create a...
Read more >
How to Verify Downloaded Files | DigitalOcean
You've probably downloaded some open-source software, ... Hashing a file doesn't encrypt the file and you can't take a checksum and run it ......
Read more >
nFront-Password-Filter-Documentation.pdf
NOTE: Please report any problems with this document to feedback@nFrontSecurity.com. ... Reject passwords with a repeating pattern of X characters.
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