From a4cbf7bfde23ddb29a74954aec3a22a1ada92967 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20P=C3=B6schl?= Date: Sun, 15 Sep 2024 22:27:23 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=91=B7=20Add=20untagged=20image=20removal?= =?UTF-8?q?=20to=20organisation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/untagged-image-removal.yaml | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 .github/workflows/untagged-image-removal.yaml diff --git a/.github/workflows/untagged-image-removal.yaml b/.github/workflows/untagged-image-removal.yaml new file mode 100644 index 0000000..4c74d58 --- /dev/null +++ b/.github/workflows/untagged-image-removal.yaml @@ -0,0 +1,35 @@ +name: Remove all untagged images from all packages +on: + workflow_dispatch: + push: + branches: + - main + schedule: + - cron: '0 23 * * *' + +jobs: + build: + name: Remove all untagged images from my packages + runs-on: ubuntu-latest + steps: + - name: 🔑 GHCR Login + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.IMAGE_REMOVAL_PAT_TOKEN }} + + - name: Delete all untagged images + id: deleted-action + uses: Chizkiyahu/delete-untagged-ghcr-action@main + with: + token: ${{ secrets.IMAGE_REMOVAL_PAT_TOKEN }} + repository_owner: ${{ github.repository_owner }} + untagged_only: true + owner_type: org + except_untagged_multiplatform: true + + - name: Output cleaned up images + run: | + echo "## :wastebasket: Summary" >> $GITHUB_STEP_SUMMARY + echo 'Deleted images count: ${{ steps.deleted-action.outputs.num_deleted }}' >> $GITHUB_STEP_SUMMARY \ No newline at end of file