One of my GitHub repository actions suddenly failed with the following error:
Error: The template is not valid. .github/workflows/run-tests.yml (Line: 38, Col: 16): hashFiles('**/composer.lock') failed.
Fail to hash files under directory '/home/runner/work/lims/lims'
After investigating, I came across a relevant Github issue. Following several attempts, I managed to resolve the issue.
- key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
+ key: ${{ runner.os }}-composer-${{ hashFiles('composer.lock', '*/composer.lock') }}
It appears that hashFiles
may encounter failures when numerous files exist in the working directory.