chore(workflow): enhance GHCR retention policy with token generation

- Added a step to generate a GitHub App token for authentication.
- Updated the deletion process to use the generated token instead of the default GITHUB_TOKEN.
- Changed the image-names parameter to delete all images instead of just "rsshub".
This commit is contained in:
zhenlonghe 2025-10-24 19:00:32 +08:00
parent fde72d9275
commit 6351b49991
No known key found for this signature in database
GPG Key ID: 9EA159BFE3809CE7
1 changed files with 10 additions and 3 deletions

View File

@ -19,12 +19,19 @@ jobs:
packages: write
contents: read
steps:
- name: Generate a token
id: generate-token
uses: actions/create-github-app-token@v1
with:
app-id: ${{ secrets.GH_APP_ID }}
private-key: ${{ secrets.GH_APP_PRIVATE_KEY }}
- name: Delete old container versions (30+ days)
uses: snok/container-retention-policy@v3.0.1
with:
account: ${{ github.repository_owner }}
token: ${{ secrets.GITHUB_TOKEN }}
image-names: "rsshub"
account: user
token: ${{ steps.generate-token.outputs.token }}
image-names: "*"
cut-off: 30d
keep-n-most-recent: 5
dry-run: false