Skip to content

Delete old container images #802

Delete old container images

Delete old container images #802

name: Delete old container images
on:
workflow_dispatch: # allow running on demand
schedule:
- cron: "0 2 * * *" # every day at 2:00am UTC
jobs:
clean-ghcr:
name: Delete old unused container images
runs-on: ubuntu-latest
steps:
- name: Delete 'spiff' main containers older than a week
# v3.0.1 tries to reference ghcr.io/snok/container-retention-policy:v3.0.1 which doesn't exist
# https://github.com/snok/container-retention-policy/issues/109
uses: snok/[email protected]
with:
account: sartography
cut-off: 3months
image-names: spiffworkflow-backend, spiffworkflow-frontend
image-tags: "main-*"
keep-n-most-recent: 1
# see https://github.com/settings/tokens/1335541013 under burnettk, classic personal access token with write:packages, read:packages, and delete:packages
token: ${{ secrets.PERSONAL_TOKEN_FOR_CONTAINER_CLEANUP }}