Skip to content

Commit

Permalink
simplified clear-cache github action
Browse files Browse the repository at this point in the history
  • Loading branch information
mbway committed Dec 30, 2023
1 parent a10c623 commit 19dcd8e
Showing 1 changed file with 5 additions and 21 deletions.
26 changes: 5 additions & 21 deletions .github/workflows/clear-cache.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,26 +10,10 @@ jobs:
clear-cache:
name: Clean Cache
runs-on: ubuntu-latest
env:
GH_TOKEN: ${{ github.token }}
steps:
- name: Clear cache
uses: actions/github-script@v7
with:
script: |
while (true) {
const caches = await github.rest.actions.getActionsCacheList({
owner: context.repo.owner,
repo: context.repo.repo,
})
if (caches.data.actions_caches.length === 0) {
break
}
for (const cache of caches.data.actions_caches) {
console.log('Deleting ' + cache.key)
github.rest.actions.deleteActionsCacheById({
owner: context.repo.owner,
repo: context.repo.repo,
cache_id: cache.id,
})
}
}
console.log("Clear cache completed")
run: |
gh cache delete --all --repo "$GITHUB_REPOSITORY"
echo "cache cleared"

0 comments on commit 19dcd8e

Please sign in to comment.