-
Notifications
You must be signed in to change notification settings - Fork 3
46 lines (40 loc) · 1.12 KB
/
refresh.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
41
42
43
44
45
46
name: refresh
on:
schedule:
# run every day at 10am UTC
- cron: "0 10 * * *"
# call manually to update scripts
workflow_dispatch:
# permissions required to do a Pages deployment
permissions:
contents: read
pages: write
id-token: write
jobs:
cleanup:
runs-on: ubuntu-latest
permissions:
# write permissions are required to delete a cache
actions: write
contents: read
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Cleanup
run: |
## Setting this to not fail the workflow while deleting cache keys.
set +e
gh extension install actions/gh-actions-cache
REPO=${{ github.repository }}
cacheKeysForPR=$(gh actions-cache list -R $REPO | cut -f 1 | grep 'assets' )
for cacheKey in $cacheKeysForPR
do
echo "deleting $cacheKey"
gh actions-cache delete $cacheKey -R $REPO --confirm
done
echo "Done"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
rebuild:
uses: ./.github/workflows/deploy.yml
needs: ["cleanup"]