Skip to content

Commit

Permalink
chore: improve cache restore keys (#2473)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
JoCa96 authored Jan 9, 2025
1 parent d30a8d8 commit 2b6742d
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions .github/templates/node-setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,22 @@ 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
uses: actions/cache@v4
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
Expand Down

0 comments on commit 2b6742d

Please sign in to comment.