Skip to content

Commit c44cb1f

Browse files
Merge pull request #62124 from nextcloud/backport/62061/stable33
[stable33] ci: migrate from buildjet to cache action
2 parents bbe1e04 + b290e72 commit c44cb1f

2 files changed

Lines changed: 21 additions & 3 deletions

File tree

.github/workflows/command-compile.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ jobs:
9797

9898
steps:
9999
- name: Restore cached git repository
100-
uses: buildjet/cache@3e70d19e31d6a8030aeddf6ed8dbe601f94d09f4 # v4.0.2
100+
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
101101
with:
102102
path: .git
103103
key: git-repo

.github/workflows/cypress.yml

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ jobs:
8585
TESTING=true npm run build --if-present
8686
8787
- name: Save context
88-
uses: buildjet/cache/save@3e70d19e31d6a8030aeddf6ed8dbe601f94d09f4 # v4.0.2
88+
uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
8989
with:
9090
key: cypress-context-${{ github.run_id }}
9191
path: ./
@@ -153,7 +153,8 @@ jobs:
153153

154154
steps:
155155
- name: Restore context
156-
uses: buildjet/cache/restore@3e70d19e31d6a8030aeddf6ed8dbe601f94d09f4 # v4.0.2
156+
id: cache
157+
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
157158
with:
158159
fail-on-cache-miss: true
159160
key: cypress-context-${{ github.run_id }}
@@ -232,6 +233,23 @@ jobs:
232233

233234
name: cypress-summary
234235

236+
permissions:
237+
# `actions:write` permission is required to delete caches
238+
# 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
239+
actions: write
240+
contents: read
241+
235242
steps:
236243
- name: Summary status
237244
run: if ${{ needs.init.result != 'success' || ( needs.cypress.result != 'success' && needs.cypress.result != 'skipped' ) }}; then exit 1; fi
245+
246+
- name: Delete cache on success
247+
run: |
248+
## Setting this to not fail the workflow while deleting cache keys.
249+
set +e
250+
echo "Deleting cache..."
251+
gh cache delete 'cypress-context-${{ github.run_id }}'
252+
echo "Done"
253+
env:
254+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
255+
GH_REPO: ${{ github.repository }}

0 commit comments

Comments
 (0)