9797 echo GHC_VERSION="${GHC_VERSION}" >> "${GITHUB_ENV}"
9898
9999 - name : 💾 Cache Haskell toolchain
100+ id : haskell-toolchain
100101 if : runner.os == 'macOS'
101- uses : actions/cache@v4
102+ uses : actions/cache/restore @v4
102103 with :
103104 path : |
104105 ~/.ghcup
@@ -117,6 +118,16 @@ jobs:
117118 ghc-version : ${{ env.GHC_VERSION }}
118119 enable-stack : true
119120 stack-version : ' latest'
121+
122+ - name : 💾 Cache Haskell toolchain
123+ if : runner.os == 'macOS' && github.ref == 'refs/heads/master' && steps.haskell-toolchain.outputs.cache-hit != 'true'
124+ uses : actions/cache/save@v4
125+ with :
126+ path : |
127+ ~/.ghcup
128+ ~/.stack/programs
129+ ~/.stack/pantry
130+ key : ${{ steps.haskell-toolchain.outputs.cache-primary-key }}
120131
121132 - name : 🎛️ Determine Stack root
122133 run : |
@@ -179,14 +190,14 @@ jobs:
179190 # things to be cached
180191
181192 - name : 💾 Cache stack global package db
182- if : always() && steps.stack-global.outputs.cache-hit != 'true'
193+ if : always() && github.ref == 'refs/heads/master' && steps.stack-global.outputs.cache-hit != 'true'
183194 uses : actions/cache/save@v4
184195 with :
185196 path : ${{ env.STACK_ROOT }}
186197 key : ${{ steps.stack-global.outputs.cache-primary-key }}
187198
188199 - name : 💾 Cache .stack-work
189- if : always() && steps.stack-work.outputs.cache-hit != 'true'
200+ if : always() && github.ref == 'refs/heads/master' && steps.stack-work.outputs.cache-hit != 'true'
190201 uses : actions/cache/save@v4
191202 with :
192203 path : .stack-work
@@ -477,7 +488,7 @@ jobs:
477488
478489 - name : Cache dist-newstyle
479490 uses : actions/cache/save@v4
480- if : steps.build-deps-other-than-agda.outcome == 'success'
491+ if : github.ref == 'refs/heads/master' && steps.build-deps-other-than-agda.outcome == 'success'
481492 with :
482493 path : als/dist-newstyle
483494 key : ${{ steps.dist-newstyle-cache-key.outputs.key }}
@@ -496,7 +507,7 @@ jobs:
496507
497508 - name : Cache native cabal
498509 uses : actions/cache/save@v4
499- if : steps.ghc-wasm-setup.outcome == 'success'
510+ if : github.ref == 'refs/heads/master' && steps.ghc-wasm-setup.outcome == 'success'
500511 with :
501512 path : |
502513 ~/.config/cabal
@@ -505,7 +516,7 @@ jobs:
505516
506517 - name : Cache ghc-wasm-meta
507518 uses : actions/cache/save@v4
508- if : steps.ghc-wasm-setup.outcome == 'success'
519+ if : github.ref == 'refs/heads/master' && steps.ghc-wasm-setup.outcome == 'success'
509520 with :
510521 path : ~/.ghc-wasm
511522 key : ${{ steps.ghc-wasm-cache-restore.outputs.cache-primary-key }}
0 commit comments