chore: add container retention policy workflow

This commit is contained in:
Tony 2025-10-25 00:32:59 +08:00
parent 2460a98428
commit 63c82c76f7
1 changed files with 24 additions and 0 deletions

24
.github/workflows/ghcr-retention.yml vendored Normal file
View File

@ -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