From c3a1963b9c86966e85a7cb2f3e4edd6b9f43f00e Mon Sep 17 00:00:00 2001 From: Robert Wlodarczyk Date: Sun, 25 Jun 2023 19:07:53 -0700 Subject: [PATCH] feat: cleanup old images on the 15th of the month. --- .github/workflows/cleanup.yml | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 .github/workflows/cleanup.yml diff --git a/.github/workflows/cleanup.yml b/.github/workflows/cleanup.yml new file mode 100644 index 0000000..73053bf --- /dev/null +++ b/.github/workflows/cleanup.yml @@ -0,0 +1,28 @@ +--- +name: cleanup + +on: + schedule: + - cron: '0 0 15 * *' + +env: + IMAGE_NAME: ${{ github.actor }}/docker-crontab + +jobs: + cleanup-docker-crontab: + runs-on: ubuntu-latest + + permissions: + contents: read + packages: write + + steps: + - name: Delete Docker images older than a month. + uses: snok/container-retention-policy@v2 + with: + account-type: personal + cut-off: One month ago UTC + keep-at-least: 4 + skip-tags: latest + image-names: ${{ env.IMAGE_NAME }} + token: ${{ secrets.GHCR_TOKEN }}