infra/specs/ghost/ghost-on-kubernetes-main/.github/workflows/registry-cleanup.yml
2025-02-01 19:01:13 +01:00

49 lines
1.4 KiB
YAML

name: Delete old container images
on:
workflow_dispatch:
permissions:
packages: write
repository-projects: read
contents: read
actions: read
id-token: write
jobs:
clean-ghcr:
name: Delete old unused container images
runs-on: ubuntu-latest
continue-on-error: true
steps:
- name: Harden Runner
uses: step-security/harden-runner@a4aa98b93cab29d9b1101a6143fb8bce00e2eac4 # v2.7.1
with:
egress-policy: audit
- name: Delete 'ghost-on-kubernetes' containers older than a week
uses: sredevopsorg/container-retention-policy@2fa6104b297f90fc3b487b4576ae431867f493cb # v2.0.0
with:
image-names: ghost-on-kubernetes
cut-off: A week ago UTC
account-type: org
org-name: sredevopsorg
keep-at-least: 3
untagged-only: false
token-type: github-token
token: ${{ github.token }}
skip-tags: main
- name: Delete all test containers older than a month, using a wildcard
uses: sredevopsorg/container-retention-policy@2fa6104b297f90fc3b487b4576ae431867f493cb # v2.0.0
with:
image-names: ghost-on-kubernetes
cut-off: One month ago UTC
account-type: org
org-name: sredevopsorg
keep-at-least: 3
skip-tags: main
untagged-only: false
token-type: github-token
token: ${{ github.token }}