Skip to content

Commit 19dcd8e

Browse files
committed
simplified clear-cache github action
1 parent a10c623 commit 19dcd8e

File tree

1 file changed

+5
-21
lines changed

1 file changed

+5
-21
lines changed

.github/workflows/clear-cache.yml

+5-21
Original file line numberDiff line numberDiff line change
@@ -10,26 +10,10 @@ jobs:
1010
clear-cache:
1111
name: Clean Cache
1212
runs-on: ubuntu-latest
13+
env:
14+
GH_TOKEN: ${{ github.token }}
1315
steps:
1416
- name: Clear cache
15-
uses: actions/github-script@v7
16-
with:
17-
script: |
18-
while (true) {
19-
const caches = await github.rest.actions.getActionsCacheList({
20-
owner: context.repo.owner,
21-
repo: context.repo.repo,
22-
})
23-
if (caches.data.actions_caches.length === 0) {
24-
break
25-
}
26-
for (const cache of caches.data.actions_caches) {
27-
console.log('Deleting ' + cache.key)
28-
github.rest.actions.deleteActionsCacheById({
29-
owner: context.repo.owner,
30-
repo: context.repo.repo,
31-
cache_id: cache.id,
32-
})
33-
}
34-
}
35-
console.log("Clear cache completed")
17+
run: |
18+
gh cache delete --all --repo "$GITHUB_REPOSITORY"
19+
echo "cache cleared"

0 commit comments

Comments
 (0)