From bc00f067c990c725373fee5a82d7754d8a91d6c1 Mon Sep 17 00:00:00 2001 From: theOehrly <23384863+theOehrly@users.noreply.github.com> Date: Sun, 27 Oct 2024 18:35:26 +0100 Subject: [PATCH] MNT/CI: switch away from deprecated save-always directive for actions/cache --- .github/workflows/docs.yml | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index e379407b..c324fd60 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -60,12 +60,14 @@ jobs: run: | mkdir doc_cache # make sure cache dir exists - - name: Cache FastF1 - uses: actions/cache@v4 + - name: Restore cache for FastF1 + id: cache-doc-restore + uses: actions/cache/restore@v4 with: - save-always: true path: ./doc_cache - key: fastf1-doc-cache-${{ hashFiles('*.*') }} + # Restore any matching cache independent of hash suffix. We cannot + # know if anything has changed at this stage. + key: fastf1-doc-cache-${{ hashFiles('./doc_cache/**/*.*') }} restore-keys: | fastf1-doc-cache @@ -94,6 +96,15 @@ jobs: with: path: docs/_build/html/ + - name: Save cache for FastF1 + id: cache-doc-save + # Save the cache even in case of a failure but only if the content of + # the cached directory has changed. + if: always() && steps.cache-doc-restore.outputs.cache-matched-key != hashFiles('./doc_cache/**/*.*') + uses: actions/cache/save@v4 + with: + key: fastf1-doc-cache-${{ hashFiles('./doc_cache/**/*.*') }} + path: ./doc_cache deploy: if: (github.event_name == 'release') || inputs.publish