Skip to content

Commit ed4b072

Browse files
fehmerMiodec
andauthored
ci: optimize prime-cache checkout (@fehmer) (#5657)
* ci: optimize prime-cache checkout (@fehmer) * capital c --------- Co-authored-by: Miodec <jack@monkeytype.com>
1 parent 642a2b2 commit ed4b072

1 file changed

Lines changed: 14 additions & 6 deletions

File tree

.github/workflows/monkey-ci.yml

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,11 @@ jobs:
6868
needs: [pre-ci]
6969
if: needs.pre-ci.outputs.should-build-be == 'true' || needs.pre-ci.outputs.should-build-fe == 'true' || needs.pre-ci.outputs.should-build-pkg == 'true' || needs.pre-ci.outputs.assets-json == 'true'
7070
steps:
71-
- uses: actions/checkout@v4
71+
- name: Checkout package-lock
72+
uses: actions/checkout@v4
73+
with:
74+
sparse-checkout: |
75+
package-lock.json
7276
7377
- name: Cache node modules
7478
id: cache-npm
@@ -77,12 +81,16 @@ jobs:
7781
cache-name: cache-node-modules
7882
with:
7983
path: ~/.npm
80-
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
84+
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('package-lock.json') }}
8185
restore-keys: |
8286
${{ runner.os }}-build-${{ env.cache-name }}-
8387
${{ runner.os }}-build-
8488
${{ runner.os }}-
8589
90+
- if: ${{ steps.cache-npm.outputs.cache-hit != 'true' }}
91+
name: Full checkout
92+
uses: actions/checkout@v4
93+
8694
- if: ${{ steps.cache-npm.outputs.cache-hit != 'true' }}
8795
name: Install dependencies
8896
run: npm install --prefer-offline --no-audit
@@ -106,7 +114,7 @@ jobs:
106114
cache-name: cache-node-modules
107115
with:
108116
path: ~/.npm
109-
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
117+
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('package-lock.json') }}
110118
restore-keys: |
111119
${{ runner.os }}-build-${{ env.cache-name }}-
112120
${{ runner.os }}-build-
@@ -150,7 +158,7 @@ jobs:
150158
cache-name: cache-node-modules
151159
with:
152160
path: ~/.npm
153-
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
161+
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('package-lock.json') }}
154162
restore-keys: |
155163
${{ runner.os }}-build-${{ env.cache-name }}-
156164
${{ runner.os }}-build-
@@ -204,7 +212,7 @@ jobs:
204212
cache-name: cache-node-modules
205213
with:
206214
path: ~/.npm
207-
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
215+
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('package-lock.json') }}
208216
restore-keys: |
209217
${{ runner.os }}-build-${{ env.cache-name }}-
210218
${{ runner.os }}-build-
@@ -247,7 +255,7 @@ jobs:
247255
cache-name: cache-node-modules
248256
with:
249257
path: ~/.npm
250-
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
258+
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('package-lock.json') }}
251259
restore-keys: |
252260
${{ runner.os }}-build-${{ env.cache-name }}-
253261
${{ runner.os }}-build-

0 commit comments

Comments
 (0)