Cleanup GHCR Build Cache #46
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: Cleanup GHCR Build Cache | |
| # Prunes the *-buildcache GHCR packages used by .github/actions/build-cosmos. | |
| # Keeps the most recent N tagged versions per package and deletes untagged | |
| # manifests left behind when cache tags are overwritten. | |
| on: | |
| schedule: | |
| - cron: "0 6 * * *" # daily at 06:00 UTC | |
| workflow_dispatch: | |
| permissions: | |
| packages: write | |
| jobs: | |
| prune: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Prune *-buildcache packages | |
| # https://github.com/dataaxiom/ghcr-cleanup-action | |
| uses: dataaxiom/ghcr-cleanup-action@f092b48ba3b604b2a83690dc4b2bbb3392e1045f # v1.2.1 | |
| with: | |
| owner: openc3 | |
| # Wildcards enabled by expand-packages — matches every cache package | |
| # created by .github/actions/build-cosmos in one shot. | |
| packages: openc3-*-buildcache | |
| expand-packages: true | |
| # Keep enough headroom for in-flight PRs while preventing the cache | |
| # backlog from growing unbounded. | |
| keep-n-tagged: 50 | |
| delete-untagged: true | |
| token: ${{ secrets.CLEANUP_GHCR_TOKEN }} |