diff --git a/.github/workflows/ghcr-retention.yml b/.github/workflows/ghcr-retention.yml new file mode 100644 index 000000000..eb4041011 --- /dev/null +++ b/.github/workflows/ghcr-retention.yml @@ -0,0 +1,24 @@ +name: 'Clean up GHCR Packages' + +on: + schedule: + - cron: '0 0 * * 0' + workflow_dispatch: + +jobs: + cleanup: + runs-on: ubuntu-latest + permissions: + packages: write + contents: read + steps: + - name: Delete old container versions (30+ days) + uses: snok/container-retention-policy@3b0972b2276b171b212f8c4efbca59ebba26eceb # v3.0.1 + with: + account: user + token: ${{ secrets.GITHUB_TOKEN }} + image-names: ${{ github.event.repository.name }} + image-tags: '* !latest' + cut-off: 30d + keep-n-most-recent: 5 + dry-run: false