cache: Cache Not Found After Previous Successful Caching: Windows (latest)

YAML File is fairly straightforward.

...
jobs:
  build:
    runs-on: windows-latest
    
    steps:
    - uses: actions/checkout@v2
    - uses: bazelbuild/setup-bazelisk@v1
    
    - name: Cache Build
          uses: actions/cache@v2
          env:
            cache-name: build-cache
          with:
            path: |
              ~/_bazel_runneradmin/*/action_cache
              ~/_bazel_runneradmin/*/execroot
              ~/_bazel_runneradmin/*/external
              ~/_bazel_runneradmin/*/server
            key: ${{ runner.os }}-${{ env.cache-name }}
...

In one repository, the cache works just fine, albeit slow (~ 4.5 mins to unravel ~1GB). I went to set up a second repository with the exact same code with the following output:

Post job cleanup.
C:\Windows\System3[2](https://github.com/J-B-Blankenship/[private_repository]/runs/5135821556?check_suite_focus=true#step:11:2)\tar.exe --posix -z -cf cache.tgz -P -C D:/a/[private_repository]/[private_repository] --files-from manifest.txt
Cache Size: ~952 MB (9984257[3](https://github.com/J-B-Blankenship/[private_repository]/runs/5135821556?check_suite_focus=true#step:11:3)[4](https://github.com/J-B-Blankenship/[private_repository]/runs/5135821556?check_suite_focus=true#step:11:4) B)
Cache saved successfully
Cache saved with key: Windows-build-cache

The next pull request rolls in:

Run actions/cache@v[2](https://github.com/J-B-Blankenship/[private_repository]/runs/5135821556?check_suite_focus=true#step:4:2)
  with:
    path: ~/_bazel_runneradmin/*/action_cache
  ~/_bazel_runneradmin/*/execroot
  ~/_bazel_runneradmin/*/external
  ~/_bazel_runneradmin/*/server
  
    key: Windows-build-cache
  env:
    cache-name: build-cache
Cache not found for input keys: Windows-build-cache

The only thing I can think of is that during the setup of the repository, the default branch was set to “main”. I manually reverted this back to the traditional “master”. All other repository settings are identical.

Any help would be greatly appreciated, including the rather long “Run actions/cache@v2” step.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 1
  • Comments: 16 (4 by maintainers)

Most upvoted comments

Running through this old thread, I can see two things which probably need to be called out clearly in documentation.

  1. The cache uniqueness is also identified by the path used. Same cache cannot be used if path is different across workflows/runs.
  2. PR check runs won’t share the cache unless the cache is created by the base branch for PRs