diff --git a/.github/workflows/pr-close-delete-env.yml b/.github/workflows/pr-close-delete-env.yml index 406ccc404..047f79ca8 100644 --- a/.github/workflows/pr-close-delete-env.yml +++ b/.github/workflows/pr-close-delete-env.yml @@ -114,6 +114,21 @@ jobs: Write-Host '❌ Key Vault not found' } + - name: Delete all untagged images + run: | + az acr manifest list-metadata ` + -r ${{ env.ACR_NAME }} ` + -n ${{ env.IMAGE_NAME }} ` + --query "[?tags==null].digest" ` + -o tsv | ` + %{ ` + az acr repository delete ` + -n ${{ env.ACR_NAME }} ` + -t ${{ env.IMAGE_NAME }}@$_ ` + --yes ` + } + Write-Host "✅ All untagged images have been deleted" + - name: ACR - Delete image run: | $imageTagWithPrefix = '${{ env.SLOT_PREFIX }}${{ matrix.SLOT_NAME}}'