about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMartin Liska <martin.liska@hey.com>2025-01-25 18:21:58 +0100
committerMartin Liska <martin.liska@hey.com>2025-01-25 18:22:00 +0100
commit1392e074b7941af2f0b4bb400e1d0c75943cfe47 (patch)
tree51b5ecf66e920c3075cb7fd06ce7b24d5b866de8
parentbda56643be5e5eb26f5287d8b0af53339b0f9f70 (diff)
downloadrust-1392e074b7941af2f0b4bb400e1d0c75943cfe47.tar.gz
rust-1392e074b7941af2f0b4bb400e1d0c75943cfe47.zip
CI: use key-restore for cache GH action
It seems one can't overwrite a cache entry:
```
Failed to save: Unable to reserve cache with key linkcheck--0.8.1, another job may be creating this cache. More details: Cache already exists. Scope: refs/heads/master, Key: linkcheck--0.8.1, Version: 33f8fd511bed9c91c40778bc5c27cb58425caa894ab50f9c5705d83cb78660e0
Warning: Cache save failed.
```

A proper solution is to use `restore-keys`:
https://github.com/actions/cache/blob/main/tips-and-workarounds.md#update-a-cache
-rw-r--r--src/doc/rustc-dev-guide/.github/workflows/ci.yml6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/doc/rustc-dev-guide/.github/workflows/ci.yml b/src/doc/rustc-dev-guide/.github/workflows/ci.yml
index 006bcce44b3..3f810e2fbcc 100644
--- a/src/doc/rustc-dev-guide/.github/workflows/ci.yml
+++ b/src/doc/rustc-dev-guide/.github/workflows/ci.yml
@@ -41,7 +41,9 @@ jobs:
         uses: actions/cache/restore@v4
         with:
           path: book/linkcheck/cache.json
-          key: linkcheck--${{ env.MDBOOK_LINKCHECK2_VERSION }}
+          key: linkcheck--${{ env.MDBOOK_LINKCHECK2_VERSION }}--${{ github.run_id }}
+          restore-keys: |
+            linkcheck--${{ env.MDBOOK_LINKCHECK2_VERSION }}--
 
       - name: Install latest nightly Rust toolchain
         if: steps.mdbook-cache.outputs.cache-hit != 'true'
@@ -66,7 +68,7 @@ jobs:
         uses: actions/cache/save@v4
         with:
           path: book/linkcheck/cache.json
-          key: linkcheck--${{ env.MDBOOK_LINKCHECK2_VERSION }}
+          key: linkcheck--${{ env.MDBOOK_LINKCHECK2_VERSION }}--${{ github.run_id }}
 
       - name: Deploy to gh-pages
         if: github.event_name == 'push'