File tree Expand file tree Collapse file tree 3 files changed +27
-12
lines changed Expand file tree Collapse file tree 3 files changed +27
-12
lines changed Original file line number Diff line number Diff line change @@ -77,23 +77,28 @@ jobs:
7777 if : runner.os != 'Windows'
7878 run : echo "dir=$(npm config get cache)" >> $GITHUB_OUTPUT
7979
80+ # New prefix generated every 120 days, to ensure npm cache doesn't grow too large
81+ - name : Get npm cache timed expiration
82+ id : npm-timed-expiration
83+ run : echo "prefix=$(( $(date +%s) / 60 / 60 / 24 / 120 ))" >> $GITHUB_OUTPUT
84+
8085 - name : Restore cache using package-lock.json hash
8186 uses : actions/cache@v3
8287 if : ${{ !inputs.no-lockfile }}
8388 with :
8489 path : ${{ steps.npm-cache-dir-windows.outputs.dir || steps.npm-cache-dir.outputs.dir }}
85- key : ${{ runner.os }}-node-${{ hashFiles('package-lock.json') }}
90+ key : ${{ runner.os }}-node-${{ steps.npm-timed-expiration.outputs.prefix }}-${{ hashFiles('package-lock.json') }}
8691 restore-keys : |
87- ${{ runner.os }}-node-
92+ ${{ runner.os }}-node-${{ steps.npm-timed-expiration.outputs.prefix }}-
8893
8994 - name : Restore cache using package.json hash
9095 uses : actions/cache@v3
9196 if : ${{ inputs.no-lockfile }}
9297 with :
9398 path : ${{ steps.npm-cache-dir-windows.outputs.dir || steps.npm-cache-dir.outputs.dir }}
94- key : ${{ runner.os }}-node-${{ hashFiles('package.json') }}
99+ key : ${{ runner.os }}-node-${{ steps.npm-timed-expiration.outputs.prefix }}-${{ hashFiles('package.json') }}
95100 restore-keys : |
96- ${{ runner.os }}-node-
101+ ${{ runner.os }}-node-${{ steps.npm-timed-expiration.outputs.prefix }}-
97102
98103 - run : npm ci --no-audit --no-fund
99104 if : ${{ !inputs.no-lockfile }}
Original file line number Diff line number Diff line change @@ -120,23 +120,28 @@ jobs:
120120 if : (inputs.npm-pre-sync-script || inputs.npm-post-sync-script) && runner.os != 'Windows'
121121 run : echo "dir=$(npm config get cache)" >> $GITHUB_OUTPUT
122122
123+ # New prefix generated every 120 days, to ensure npm cache doesn't grow too large
124+ - name : Get npm cache timed expiration
125+ id : npm-timed-expiration
126+ run : echo "prefix=$(( $(date +%s) / 60 / 60 / 24 / 120 ))" >> $GITHUB_OUTPUT
127+
123128 - name : Restore cache using package-lock.json hash
124129 uses : actions/cache@v3
125130 if : (inputs.npm-pre-sync-script || inputs.npm-post-sync-script) && !inputs.no-lockfile
126131 with :
127132 path : ${{ steps.npm-cache-dir-windows.outputs.dir || steps.npm-cache-dir.outputs.dir }}
128- key : ${{ runner.os }}-node-${{ hashFiles('package-lock.json') }}
133+ key : ${{ runner.os }}-node-${{ steps.npm-timed-expiration.outputs.prefix }}-${{ hashFiles('package-lock.json') }}
129134 restore-keys : |
130- ${{ runner.os }}-node-
135+ ${{ runner.os }}-node-${{ steps.npm-timed-expiration.outputs.prefix }}-
131136
132137 - name : Restore cache using package.json hash
133138 uses : actions/cache@v3
134139 if : (inputs.npm-pre-sync-script || inputs.npm-post-sync-script) && inputs.no-lockfile
135140 with :
136141 path : ${{ steps.npm-cache-dir-windows.outputs.dir || steps.npm-cache-dir.outputs.dir }}
137- key : ${{ runner.os }}-node-${{ hashFiles('package.json') }}
142+ key : ${{ runner.os }}-node-${{ steps.npm-timed-expiration.outputs.prefix }}-${{ hashFiles('package.json') }}
138143 restore-keys : |
139- ${{ runner.os }}-node-
144+ ${{ runner.os }}-node-${{ steps.npm-timed-expiration.outputs.prefix }}-
140145
141146 - run : npm ci --no-audit --no-fund
142147 if : (inputs.npm-pre-sync-script || inputs.npm-post-sync-script) && !inputs.no-lockfile
Original file line number Diff line number Diff line change @@ -83,23 +83,28 @@ jobs:
8383 if : runner.os != 'Windows'
8484 run : echo "dir=$(npm config get cache)" >> $GITHUB_OUTPUT
8585
86+ # New prefix generated every 120 days, to ensure npm cache doesn't grow too large
87+ - name : Get npm cache timed expiration
88+ id : npm-timed-expiration
89+ run : echo "prefix=$(( $(date +%s) / 60 / 60 / 24 / 120 ))" >> $GITHUB_OUTPUT
90+
8691 - name : Restore cache using package-lock.json hash
8792 uses : actions/cache@v3
8893 if : ${{ !inputs.no-lockfile }}
8994 with :
9095 path : ${{ steps.npm-cache-dir-windows.outputs.dir || steps.npm-cache-dir.outputs.dir }}
91- key : ${{ runner.os }}-node-${{ hashFiles('package-lock.json') }}
96+ key : ${{ runner.os }}-node-${{ steps.npm-timed-expiration.outputs.prefix }}-${{ hashFiles('package-lock.json') }}
9297 restore-keys : |
93- ${{ runner.os }}-node-
98+ ${{ runner.os }}-node-${{ steps.npm-timed-expiration.outputs.prefix }}-
9499
95100 - name : Restore cache using package.json hash
96101 uses : actions/cache@v3
97102 if : ${{ inputs.no-lockfile }}
98103 with :
99104 path : ${{ steps.npm-cache-dir-windows.outputs.dir || steps.npm-cache-dir.outputs.dir }}
100- key : ${{ runner.os }}-node-${{ hashFiles('package.json') }}
105+ key : ${{ runner.os }}-node-${{ steps.npm-timed-expiration.outputs.prefix }}-${{ hashFiles('package.json') }}
101106 restore-keys : |
102- ${{ runner.os }}-node-
107+ ${{ runner.os }}-node-${{ steps.npm-timed-expiration.outputs.prefix }}-
103108
104109 - run : npm ci --no-audit --no-fund
105110 if : ${{ !inputs.no-lockfile }}
You can’t perform that action at this time.
0 commit comments