From 612a10ead75d9c50897a1f620bb04c478e1e784a Mon Sep 17 00:00:00 2001 From: Erik Godding Boye Date: Mon, 2 Oct 2023 17:10:29 +0200 Subject: [PATCH] ci: reuse clean GHCR workflow (#608) --- .github/workflows/clean-ghcr.yaml | 27 +++++++++------------------ 1 file changed, 9 insertions(+), 18 deletions(-) diff --git a/.github/workflows/clean-ghcr.yaml b/.github/workflows/clean-ghcr.yaml index 5126c556..8e6d7c9d 100644 --- a/.github/workflows/clean-ghcr.yaml +++ b/.github/workflows/clean-ghcr.yaml @@ -1,25 +1,16 @@ --- -name: Delete obsolete container images +name: Delete Obsolete GHCR Images on: schedule: - cron: "0 1 * * *" # every day at midnight workflow_dispatch: -permissions: - contents: read + jobs: - clean-ghcr: - name: Delete obsolete container images - if: ${{ github.repository == 'statnett/image-scanner-operator' }} + trigger: + uses: statnett/workflows/.github/workflows/clean-ghcr.yaml@main + with: + image-names: ${{ github.event.repository.name }} + secrets: + PAT: ${{ secrets.BOT_PAT }} permissions: - packages: write # for snok/container-retention-policy to delete images - runs-on: ubuntu-latest - steps: - - name: Delete untagged container images older than a week - uses: snok/container-retention-policy@04c70fd030033036d69c0057e0d125bf25820544 # v2.1.2 - with: - image-names: image-scanner-operator - cut-off: A week ago UTC - account-type: org - org-name: statnett - untagged-only: true - token: ${{ secrets.BOT_PAT }} + packages: write