Garbage collect github CI cache #9
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: Garbage collect github CI cache | |
# Run every 4 hours | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: 0 */4 * * * | |
permissions: | |
actions: write | |
jobs: | |
run-script: | |
# Clone the CIRCT repo and its submodules. Do shallow clone to save clone | |
# time. | |
name: Garbage collect cache | |
runs-on: ubuntu-latest | |
steps: | |
- name: Get CIRCT | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 2 | |
submodules: "false" | |
- name: Set git safe | |
run: | | |
git config --global --add safe.directory $PWD | |
- name: Check cache and remove | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
# Pretty print | |
gh cache list -k ccache-short-clang-Release-ON-ON -L 50 | |
# Keep top 5 caches (in the case LLVM bump involved) | |
gh cache list -k ccache-short-clang-Release-ON-ON -L 50 --jq ".[5:]|.[].id" --json id | ./utils/delete-cache.sh |