From 2b6742df65d400ca45183cdb73c946e0244ea17f Mon Sep 17 00:00:00 2001 From: Jonathan Date: Thu, 9 Jan 2025 15:52:46 +0100 Subject: [PATCH] chore: improve cache restore keys (#2473) Improved cache restore keys, as they only matched the same day. If the day was different, the cache key didn't match anymore. Also using `hashFiles` with the cache content doesn't make sense. --- .github/templates/node-setup/action.yml | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/.github/templates/node-setup/action.yml b/.github/templates/node-setup/action.yml index 2105a2f16c..9f70f2b889 100644 --- a/.github/templates/node-setup/action.yml +++ b/.github/templates/node-setup/action.yml @@ -33,7 +33,9 @@ runs: - name: 📆 Get Date id: get-date run: | - echo "date=$(/bin/date -u "+%Y%m%d")" >> $GITHUB_OUTPUT + echo "day=$(/bin/date -u "+%d")" >> $GITHUB_OUTPUT + echo "month=$(/bin/date -u "+%m")" >> $GITHUB_OUTPUT + echo "year=$(/bin/date -u "+%Y")" >> $GITHUB_OUTPUT shell: bash - name: 🫙 Cache @@ -41,10 +43,12 @@ runs: with: path: | **/.cache - key: build-caches-${{ runner.os }}-${{ steps.get-date.outputs.date }}-${{ hashFiles('**/.cache') }} + key: build-caches-${{ steps.get-date.outputs.year }}-${{ steps.get-date.outputs.month }}-${{ steps.get-date.outputs.day }} restore-keys: | - build-caches-${{ runner.os }}-${{ steps.get-date.outputs.date }}- - build-caches-${{ runner.os }}- + build-caches-${{ steps.get-date.outputs.year }}-${{ steps.get-date.outputs.month }}-${{ steps.get-date.outputs.day }} + build-caches-${{ steps.get-date.outputs.year }}-${{ steps.get-date.outputs.month }}- + build-caches-${{ steps.get-date.outputs.year }}- + build-caches- - name: 📦 Install dependencies run: pnpm install