Cache restored on exact key, but cache-hit is false
I am caching the build directory of swift-format. The cache is being restored successfully on the exact key, but the cache-hit variable seems being set to false. Is the code wrong or is there a bug in the action?
- name: Create swift-format build cache
id: cache-swift-format
uses: actions/cache@v3
with:
path: .build
key: ${{ runner.os }}-spm-${{ hashFiles('**/Package.resolved') }}
restore-keys: |
${{ runner.os }}-spm-
- name: build swift-format
if: steps.cache-swift-format.outputs.cache-hit != 'true'
run: |
git clone https://github.com/apple/swift-format.git
cd swift-format
swift build --disable-sandbox -c release
mv .build ..
The output from the latest job:
@andreiz , When the workflow is running for a PR, it can restore cache from the main branch. However, cache hit will be false in this case. There are a couple of more cases mentioned here : https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#matching-a-cache-key
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.