name: Delete old container images

on:
  workflow_dispatch:
  schedule:
    - cron: "0 0 * * *"  # every day at midnight


jobs:
  dev-clean-ghcr:
    name: Delete old unused dev container images
    runs-on: ubuntu-latest
    steps:
      - name: Delete dev branch containers older than a month
        uses: snok/container-retention-policy@b56f4ff7539c1f94f01e5dc726671cd619aa8072 # v2.2.1
        with:
          image-names: qdrant
          cut-off: A month ago UTC
          account-type: org
          org-name: qdrant
          keep-at-least: 10
          filter-tags: dev-*
          token-type: github-token
          token: ${{ secrets.GITHUB_TOKEN }}
          dry-run: true
