7474 run : npm i -g 'npm@${{ steps.versions.outputs.npmVersion }}'
7575
7676 - name : Restore npm cache
77- uses : buildjet /cache/restore@3e70d19e31d6a8030aeddf6ed8dbe601f94d09f4 # v4.0.2
77+ uses : actions /cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
7878 with :
7979 path : ~/.npm
8080 key : node-${{ steps.versions.outputs.nodeVersion }}-npm-${{ steps.versions.outputs.npmVersion }}-${{ hashFiles('**/package-lock.json') }}
@@ -85,13 +85,13 @@ jobs:
8585 TESTING=true npm run build --if-present
8686
8787 - name : Save npm cache
88- uses : buildjet /cache/save@3e70d19e31d6a8030aeddf6ed8dbe601f94d09f4 # v4.0.2
88+ uses : actions /cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
8989 with :
9090 path : ~/.npm
9191 key : node-${{ steps.versions.outputs.nodeVersion }}-npm-${{ steps.versions.outputs.npmVersion }}-${{ hashFiles('**/package-lock.json') }}
9292
9393 - name : Save context
94- uses : buildjet /cache/save@3e70d19e31d6a8030aeddf6ed8dbe601f94d09f4 # v4.0.2
94+ uses : actions /cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
9595 with :
9696 key : cypress-context-${{ github.run_id }}
9797 path : ./
@@ -160,7 +160,7 @@ jobs:
160160 steps :
161161 - name : Restore context
162162 id : cache
163- uses : buildjet /cache/restore@3e70d19e31d6a8030aeddf6ed8dbe601f94d09f4 # v4.0.2
163+ uses : actions /cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
164164 with :
165165 key : cypress-context-${{ github.run_id }}
166166 path : ./
@@ -258,12 +258,23 @@ jobs:
258258
259259 name : cypress-summary
260260
261+ permissions :
262+ # `actions:write` permission is required to delete caches
263+ # 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
264+ actions : write
265+ contents : read
266+
261267 steps :
262268 - name : Summary status
263269 run : if ${{ needs.init.result != 'success' || ( needs.cypress.result != 'success' && needs.cypress.result != 'skipped' ) }}; then exit 1; fi
264270
265271 - name : Delete cache on success
266- uses : buildjet/cache-delete@7184288b8396c4492a56728c47dd286fbd1e96ae # v1
267- if : needs.init.result == 'success' && needs.cypress.result == 'success'
268- with :
269- cache_key : cypress-context-${{ github.run_id }}
272+ run : |
273+ ## Setting this to not fail the workflow while deleting cache keys.
274+ set +e
275+ echo "Deleting cache..."
276+ gh cache delete 'cypress-context-${{ github.run_id }}'
277+ echo "Done"
278+ env :
279+ GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
280+ GH_REPO : ${{ github.repository }}
0 commit comments