@@ -110,7 +110,7 @@ jobs:
110110 run : npm i -g 'npm@${{ steps.versions.outputs.npmVersion }}'
111111
112112 - name : Restore npm cache
113- uses : buildjet /cache/restore@3e70d19e31d6a8030aeddf6ed8dbe601f94d09f4 # v4.0.2
113+ uses : actions /cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
114114 with :
115115 path : ~/.npm
116116 key : node-${{ steps.versions.outputs.nodeVersion }}-npm-${{ steps.versions.outputs.npmVersion }}-${{ hashFiles('**/package-lock.json') }}
@@ -121,13 +121,13 @@ jobs:
121121 TESTING=true npm run build --if-present
122122
123123 - name : Save npm cache
124- uses : buildjet /cache/save@3e70d19e31d6a8030aeddf6ed8dbe601f94d09f4 # v4.0.2
124+ uses : actions /cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
125125 with :
126126 path : ~/.npm
127127 key : node-${{ steps.versions.outputs.nodeVersion }}-npm-${{ steps.versions.outputs.npmVersion }}-${{ hashFiles('**/package-lock.json') }}
128128
129129 - name : Save context
130- uses : buildjet /cache/save@3e70d19e31d6a8030aeddf6ed8dbe601f94d09f4 # v4.0.2
130+ uses : actions /cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
131131 with :
132132 key : cypress-context-${{ github.run_id }}
133133 path : ./
@@ -196,7 +196,7 @@ jobs:
196196 steps :
197197 - name : Restore context
198198 id : cache
199- uses : buildjet /cache/restore@3e70d19e31d6a8030aeddf6ed8dbe601f94d09f4 # v4.0.2
199+ uses : actions /cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
200200 with :
201201 key : cypress-context-${{ github.run_id }}
202202 path : ./
@@ -294,12 +294,23 @@ jobs:
294294
295295 name : cypress-summary
296296
297+ permissions :
298+ # `actions:write` permission is required to delete caches
299+ # See also: https://docs.github.com/en/rest/actions/cache?apiVersion=2022-11-28#delete-a-github-actions-cache-for-a-repository-using-a-cache-id
300+ actions : write
301+ contents : read
302+
297303 steps :
298304 - name : Summary status
299305 run : if ${{ needs.init.result != 'success' || ( needs.cypress.result != 'success' && needs.cypress.result != 'skipped' ) }}; then exit 1; fi
300306
301307 - name : Delete cache on success
302- uses : buildjet/cache-delete@7184288b8396c4492a56728c47dd286fbd1e96ae # v1
303- if : needs.init.result == 'success' && needs.cypress.result == 'success'
304- with :
305- cache_key : cypress-context-${{ github.run_id }}
308+ run : |
309+ ## Setting this to not fail the workflow while deleting cache keys.
310+ set +e
311+ echo "Deleting cache..."
312+ gh cache delete 'cypress-context-${{ github.run_id }}'
313+ echo "Done"
314+ env :
315+ GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
316+ GH_REPO : ${{ github.repository }}
0 commit comments