Skip to content

Cache invalidation

Cache invalidation #9

Workflow file for this run

name: Cache invalidation
on:
workflow_dispatch:
schedule:
- cron: 0 7 1 * *
jobs:
delete:
name: Deleting
runs-on: ubuntu-latest
steps:
- name: Checkout the repository
uses: actions/checkout@v4
with: { fetch-depth: 0 }
- name: Install a GitHub CLI cache extension
run: gh extension install actions/gh-actions-cache
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Cleanup caches
run: |
keys=$(gh actions-cache list -R '${{ github.repository }}' | cut -f1)
if [ -z "${keys}" ]; then echo 'Nothing to do' && exit 0; fi
echo Deleting caches...
for key in ${keys}; do
gh actions-cache delete "${key}" -R '${{ github.repository }}' --confirm || true
done
echo Done
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
notify:
name: Notifying
needs: [ delete ]
runs-on: ubuntu-latest
if: failure() || success()
steps:
- name: Send Slack notification
uses: rtCamp/action-slack-notify@v2
env:
SLACK_COLOR: ${{ contains(needs.*.result, 'failure') && 'failure' || 'success' }}
SLACK_ICON: https://github.com/github.png?size=64
SLACK_TITLE: '🧹 ${{ github.repository }}: ${{ github.workflow }}'
SLACK_USERNAME: GitHub Actions
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}