refresh #527
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: 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"] |