Bust Runner Caches #33
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
name: Bust Runner Caches | |
on: | |
workflow_dispatch: | |
schedule: | |
# https://crontab.guru/#0_0_*_*_0 | |
- cron: '0 0 * * 0' | |
# Disable permissions for all available scopes. | |
# Enable permissions for specific scopes as needed on job level. | |
permissions: {} | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
bust-cache: | |
runs-on: ubuntu-latest | |
permissions: | |
actions: write | |
steps: | |
- name: Bust cache | |
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea #v7.0.1 | |
with: | |
script: | | |
const caches = await github.rest.actions.getActionsCacheList({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
}) | |
for (const cache of caches.data.actions_caches) { | |
console.log(`Clearing ${cache.id}`) | |
github.rest.actions.deleteActionsCacheById({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
cache_id: cache.id, | |
}) | |
} | |
console.log(`Caches cleared at ${new Date().toISOString()}`) |