Container Image Garbage Collection #14
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: Container Image Garbage Collection | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| retention-days: | |
| description: "Delete container images older than this many days" | |
| required: false | |
| default: "14" | |
| type: string | |
| dry-run: | |
| description: "Dry run mode - don't actually delete anything" | |
| required: false | |
| default: false | |
| type: boolean | |
| schedule: | |
| # Run weekly on Sundays at 2 AM UTC | |
| - cron: '0 2 * * 0' | |
| jobs: | |
| cleanup: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| packages: write | |
| steps: | |
| - name: Delete old container images | |
| uses: snok/container-retention-policy@v3.0.1 | |
| with: | |
| account: ${{ github.repository_owner }} | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| cut-off: ${{ github.event.inputs.retention-days || '14' }}d | |
| dry-run: ${{ github.event.inputs.dry-run || false }} | |