Failure in absolute path resolution
While using the cache action, I noticed that we are seeing the following warning in the Post Cache phase:
Warning: Path Validation Error: Path(s) specified in the action for caching do(es) not exist, hence no cache is being saved.
Due to this, our cache never actually gets saved. However, upon debugging further, I realized that the path does in fact exist on the runner. Workflow.yml steps used for debugging:
- name: Mount bazel cache
uses: actions/cache@v3
with:
path: |
"~/.cache/bazel"
"/home/runner/.cache/bazel"
key: bazel-cache-${{ hashFiles('**/BUILD.bazel', '**/*.bzl', 'WORKSPACE') }}
restore-keys: |
bazel-cache-
# Build all bazel targets in the repository
- name: Bazel build
run: bazel build //...
- name: bazel info
run: |
bazel info
- name: ls check 1
run: |
cd /home/runner/.cache/bazel
ls -R | head -15
- name: ls check 2
run: |
cd ~/.cache/bazel
ls -R | head -15
The job output in the Github UI:

The ls commands generate outputs, but the cache action is unable to find the same paths.
Further, I enabled debug logging on the actions and I think the issue in the file dist/save/index.js. And based on the debug logs the issue is in the globGenerator() method. I'm not familiar with JS, so I was unable to investigate further.
Debug logs:

Looking at the cache examples, many examples are using absolute paths. Unless I'm missing something (very likely 😄) this should be affecting them as well.
I think the issue here is that the cache paths are quoted. This seems to break the path resolution, thinking it's a relative path
Lovely 🤦 . Removing the quotes was sufficient and fixed the issue for me. Thanks @devversion.
In the course of trying to debug this issue I came across multiple examples from other folks who had also used quotes and didn't even know that their CI cache isn't working.
Examples: https://github.com/bazel-contrib/rules-template/blob/main/.github/workflows/ci.yaml#L45 https://github.com/AcademySoftwareFoundation/openexr/actions/runs/829321602/workflow
Any chance we could update the path resolution method to trim the quotes and make this idiot-proof 😄
Thank you @devversion for answering this. @pramodka-revefi Yes, we can explore the enhancement to remove quotes during path resolution. I'll take a look.
Please add the path to the log message!
This issue is stale because it has been open for 200 days with no activity. Leave a comment to avoid closing this issue in 5 days.
This issue was closed because it has been inactive for 5 days since being marked as stale.