-
Notifications
You must be signed in to change notification settings - Fork 383
40 lines (36 loc) · 1.19 KB
/
cache-buster.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
---
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()}`)