dioxus/.github/workflows/wipe_cache.yml

38 lines
1,014 B
YAML
Raw Normal View History

2024-01-08 18:36:35 -08:00
name: Clear cache
on:
workflow_dispatch:
permissions:
actions: write
jobs:
clear-cache:
runs-on: ubuntu-latest
steps:
- name: Clear cache
uses: actions/github-script@v7
2024-01-08 18:36:35 -08:00
with:
2024-01-08 18:50:47 -08:00
github-token: ${{ secrets.cache_controller }}
2024-01-08 18:36:35 -08:00
script: |
console.log("About to clear")
2024-01-08 18:39:26 -08:00
while (true) {
const caches = await github.rest.actions.getActionsCacheList({
2024-01-08 18:36:35 -08:00
owner: context.repo.owner,
2024-01-08 18:50:47 -08:00
repo: context.repo.repo
2024-01-08 18:36:35 -08:00
})
2024-01-08 18:39:26 -08:00
if (caches.data.actions_caches.length === 0) {
break
}
for (const cache of caches.data.actions_caches) {
console.log(cache)
github.rest.actions.deleteActionsCacheById({
owner: context.repo.owner,
repo: context.repo.repo,
cache_id: cache.id,
})
}
2024-01-08 18:36:35 -08:00
}
console.log("Clear completed")