Clean up GitHub Actions cache #238
This file contains hidden or 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: Clean up GitHub Actions cache | |
| on: | |
| workflow_dispatch: | |
| schedule: | |
| - cron: "32 */12 * * MON-FRI" | |
| jobs: | |
| cleanup: | |
| name: Clean up GitHub Actions cache | |
| permissions: | |
| actions: write | |
| runs-on: ubuntu-latest | |
| steps: | |
| - run: | | |
| gh cache list \ | |
| --json id,lastAccessedAt,ref \ | |
| --limit 100 \ | |
| --sort last_accessed_at \ | |
| --order asc \ | |
| --jq '.[] | select(.ref | startswith("refs/heads/gh-readonly-queue/")) | .id' | \ | |
| xargs -n1 gh cache delete | |
| env: | |
| GH_REPO: ${{ github.repository }} | |
| GH_TOKEN: ${{ github.token }} |