Skip to content

Commit 05cd8b7

Browse files
authored
Merge pull request #787 from IntersectMBO/mgalazyn/chore/use-ghc-patch-version-in-cache-name
GHA | add GHC patch version to the cache name
2 parents efe0b3d + ee89d5c commit 05cd8b7

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

.github/workflows/haskell.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,11 @@ jobs:
9898
9999
# Use a fresh cache each month
100100
- name: Store month number as environment variable used in cache version
101-
run: echo "MONTHNUM=$(date -u '+%m')" >> $GITHUB_ENV
101+
run: |
102+
cat <<EOF >> $GITHUB_ENV
103+
MONTHNUM=$(date -u '+%m')
104+
GHC=$(ghc --numeric-version)
105+
EOF
102106
103107
# From the dependency list we restore the cached dependencies.
104108
# We use the hash of `dependencies.txt` as part of the cache key because that will be stable
@@ -111,10 +115,10 @@ jobs:
111115
${{ steps.setup-haskell.outputs.cabal-store }}
112116
dist-newstyle
113117
key:
114-
cache-${{ env.CABAL_CACHE_VERSION }}-${{ runner.os }}-${{ matrix.ghc }}-${{ env.MONTHNUM }}-${{ hashFiles('dependencies.txt') }}
118+
cache-${{ env.CABAL_CACHE_VERSION }}-${{ runner.os }}-${{ env.GHC }}-${{ env.MONTHNUM }}-${{ hashFiles('dependencies.txt') }}
115119
# try to restore previous cache from this month if there's no cache for the dependencies set
116120
restore-keys: |
117-
cache-${{ env.CABAL_CACHE_VERSION }}-${{ runner.os }}-${{ matrix.ghc }}-${{ env.MONTHNUM }}-
121+
cache-${{ env.CABAL_CACHE_VERSION }}-${{ runner.os }}-${{ env.GHC }}-${{ env.MONTHNUM }}-
118122
119123
# Now we install the dependencies. If the cache was found and restored in the previous step,
120124
# this should be a no-op, but if the cache key was not found we need to build stuff so we can

0 commit comments

Comments
 (0)