Skip to content

Commit b570a10

Browse files
committed
use hash instead of date in bootstrap cache keys
Without some distinct identifier, downloaded sources will accumulate (and have been since the last time the datestamp was updated). The old caches are ignored and will be purged according to GitHub's cache expiration, because otherwise we'd continue to carry 4 years' worth of outdated source tarballs.
1 parent 1462707 commit b570a10

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

.github/workflows/bootstrap.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ jobs:
3232
rm -rf ~/.config/cabal
3333
rm -rf ~/.cache/cabal
3434
35+
- uses: actions/checkout@v6
36+
3537
# runner.os isn't sufficient for binary compatible caches
3638
- name: Get runner OS/version for cache keys
3739
id: get-osver
@@ -42,10 +44,9 @@ jobs:
4244
id: bootstrap-cache
4345
with:
4446
path: "/home/runner/work/cabal/cabal/_build"
45-
key: bootstrap-${{ steps.get-osver.outputs.osver }}-${{ matrix.ghc }}-20221115-${{ github.sha }}
46-
restore-keys: bootstrap-${{ steps.get-osver.outputs.osver }}-${{ matrix.ghc }}-20221115-
47+
key: bootstrap-${{ steps.get-osver.outputs.osver }}-${{ matrix.ghc }}-${{ hashFiles(format('bootstrap/linux-{0}.json', matrix.ghc)) }}-${{ github.sha }}
48+
restore-keys: bootstrap-${{ steps.get-osver.outputs.osver }}-${{ matrix.ghc }}-${{ hashFiles(format('bootstrap/linux-{0}.json', matrix.ghc)) }}-
4749

48-
- uses: actions/checkout@v6
4950
- uses: haskell-actions/setup@v2
5051
with:
5152
ghc-version: ${{ matrix.ghc }}

0 commit comments

Comments
 (0)