From f40a7b013bd7a56ee38d35406844a0916b876b56 Mon Sep 17 00:00:00 2001 From: Vedran Kasalica Date: Mon, 2 Sep 2024 23:43:00 +0200 Subject: [PATCH] Update clean-containers --- .github/workflows/clean-containers.yaml | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/workflows/clean-containers.yaml b/.github/workflows/clean-containers.yaml index b4ab0a0..af6684b 100644 --- a/.github/workflows/clean-containers.yaml +++ b/.github/workflows/clean-containers.yaml @@ -1,9 +1,9 @@ name: "Clean the old docker images" on: - workflow_dispatch: # This line adds the manual trigger + workflow_dispatch: # Manual trigger schedule: - - cron: "21 21 * * *" + - cron: "21 21 * * *" # Scheduled run jobs: clean-ghcr: @@ -13,19 +13,19 @@ jobs: packages: write env: REGISTRY: ghcr.io + steps: - - name: downcase REPO name - run: | - echo "REPO=${GITHUB_REPOSITORY,,}" >> $GITHUB_ENV + - name: Set REPO environment variable + run: echo "REPO=${GITHUB_REPOSITORY,,}" >> $GITHUB_ENV + - name: Delete 'PR' containers older than a week uses: snok/container-retention-policy@v3.0.0 with: + account: user image-names: ${{ env.REGISTRY }}/${{ env.REPO }} - filter-tags: "sha-*,sha256:*" - skip-tags: latest - cut-off: "A week ago UTC" - account-type: org - org-name: ${{ github.repository_owner }} - keep-at-least: 1 token: ${{ secrets.GH_REPO_TOKEN }} - timestamp-to-use: updated_at + image-tags: "pr*" # target any image that has a tag starting with the word test or dev + # image-tags: "!latest" + cut-off: 2w 3d + dry-run: true +