Skip to content

Image Retention Policy #24

Image Retention Policy

Image Retention Policy #24

name: Image Retention Policy
on:
workflow_dispatch:
schedule: [{cron: '0 0 2 * *'}] # the second of every month
jobs:
clean-ghcr:
runs-on: ubuntu-latest
steps:
- uses: tibdex/github-app-token@v2
id: generate-token
with:
app_id: ${{ secrets.CATHY_CLOUD_APP_ID }}
private_key: ${{ secrets.CATHY_CLOUD_APP_PRIVATE_KEY }}
- name: Delete old images
uses: snok/container-retention-policy@v2
with:
account-type: org
org-name: andreykaipov
token: ${{ steps.generate-token.outputs.token }}
token-type: github-token
image-names: ${{ github.event.repository.name }}
cut-off: one month ago EST
untagged-only: true
filter-include-untagged: true
keep-at-least: 5