From 363ce784af5390fbb04b282648c4d05f02f35619 Mon Sep 17 00:00:00 2001 From: sidey79 <7968127+sidey79@users.noreply.github.com> Date: Tue, 23 Jul 2024 20:00:38 +0200 Subject: [PATCH] feat[packages]: Implement celanup action in dry-run mode --- .github/workflows/registryCleanup.yml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 .github/workflows/registryCleanup.yml diff --git a/.github/workflows/registryCleanup.yml b/.github/workflows/registryCleanup.yml new file mode 100644 index 00000000..c4bb4002 --- /dev/null +++ b/.github/workflows/registryCleanup.yml @@ -0,0 +1,24 @@ +name: Delete old container images + +on: + workflow_dispatch: + # schedule: + # - cron: "0 0 * * *" # every day at midnight + pull_request: + branches: [ dev ] + +jobs: + delete-package-versions: + name: Delete package versions older than 4 weeks, but keep the latest 5 in case of rollbacks + runs-on: ubuntu-latest + steps: + - uses: snok/container-retention-policy@v3.0.0 + with: + account: ${{ github.repository_owner }} + token: ${{ secrets.GITHUB_TOKEN }} + image-names: "fhem-docker fhem-minimal-docker" # select three packages + image-tags: "dev !latest pr*" # any image tag + tag-selection: both # select both tagged and untagged package versions + cut-off: 6w # package versions should be older than 4 weeks + keep-n-most-recent: 5 # keep up to `n` tagged package versions for each of the packages + dry-run: true \ No newline at end of file