GHCR Cleanup #2
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: GHCR Cleanup | |
| on: | |
| schedule: | |
| - cron: '0 3 * * 0' # Sundays 03:00 UTC | |
| workflow_dispatch: | |
| inputs: | |
| dry-run: | |
| description: 'Dry run (preview deletions without executing)' | |
| type: boolean | |
| default: false | |
| jobs: | |
| cleanup-app-images: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| packages: write | |
| steps: | |
| - name: Delete old commit-tagged images (keep semver + main + latest) | |
| uses: snok/container-retention-policy@v3.0.1 | |
| with: | |
| account: ${{ github.repository_owner }} | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| image-names: ${{ github.event.repository.name }} | |
| image-tags: "!v*-full !v*-simple !main-full !main-simple !latest" | |
| tag-selection: tagged | |
| cut-off: 30d | |
| dry-run: ${{ github.event.inputs.dry-run || 'false' }} | |
| - name: Delete untagged app image manifests | |
| uses: snok/container-retention-policy@v3.0.1 | |
| with: | |
| account: ${{ github.repository_owner }} | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| image-names: ${{ github.event.repository.name }} | |
| tag-selection: untagged | |
| cut-off: 7d | |
| dry-run: ${{ github.event.inputs.dry-run || 'false' }} | |
| cleanup-cache-images: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| packages: write | |
| steps: | |
| - name: Delete untagged buildx cache manifests | |
| uses: snok/container-retention-policy@v3.0.1 | |
| with: | |
| account: ${{ github.repository_owner }} | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| image-names: ${{ github.event.repository.name }}/cache | |
| tag-selection: untagged | |
| cut-off: 7d | |
| dry-run: ${{ github.event.inputs.dry-run || 'false' }} | |
| cleanup-sif-images: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| packages: write | |
| steps: | |
| - name: Delete old commit-tagged SIFs (keep semver + main + latest) | |
| uses: snok/container-retention-policy@v3.0.1 | |
| with: | |
| account: ${{ github.repository_owner }} | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| image-names: ${{ github.event.repository.name }}/sif | |
| image-tags: "!v*-full !v*-simple !main-full !main-simple !latest" | |
| tag-selection: tagged | |
| cut-off: 30d | |
| dry-run: ${{ github.event.inputs.dry-run || 'false' }} | |
| - name: Delete untagged SIF manifests | |
| uses: snok/container-retention-policy@v3.0.1 | |
| with: | |
| account: ${{ github.repository_owner }} | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| image-names: ${{ github.event.repository.name }}/sif | |
| tag-selection: untagged | |
| cut-off: 7d | |
| dry-run: ${{ github.event.inputs.dry-run || 'false' }} |