diff --git a/.github/workflows/cleanup-dangling-images.yml b/.github/workflows/cleanup-dangling-images.yml new file mode 100644 index 000000000..42101cbf9 --- /dev/null +++ b/.github/workflows/cleanup-dangling-images.yml @@ -0,0 +1,28 @@ +name: Cleanup dangling container images + +on: + workflow_dispatch: + inputs: + dry_run: + description: "Preview only (do not delete image versions)" + type: boolean + default: false + +# Share this lock with publishing and the other cleanup workflow. +concurrency: + group: ghcr-images + cancel-in-progress: false + +jobs: + cleanup: + runs-on: ubuntu-latest + timeout-minutes: 120 + permissions: + packages: write + steps: + # Untagged architecture manifests can still belong to a tagged image. + - name: Delete untagged and unreferenced versions + uses: dataaxiom/ghcr-cleanup-action@d52806a0dc70b430571a37da1fde39733ffd640f # v1.2.2 + with: + delete-untagged: true + dry-run: ${{ inputs.dry_run }} diff --git a/.github/workflows/cleanup-sha-images.yml b/.github/workflows/cleanup-sha-images.yml new file mode 100644 index 000000000..72f385a90 --- /dev/null +++ b/.github/workflows/cleanup-sha-images.yml @@ -0,0 +1,32 @@ +name: Cleanup sha- container images + +on: + workflow_dispatch: + inputs: + dry_run: + description: "Preview only (do not delete image versions)" + type: boolean + default: false + +# Share this lock with publishing and the other cleanup workflow. +concurrency: + group: ghcr-images + cancel-in-progress: false + +jobs: + cleanup: + runs-on: ubuntu-latest + timeout-minutes: 120 + permissions: + packages: write + steps: + # The repository needs Admin access under the package's Manage Actions access. + - name: Delete versions with only sha- tags + uses: dataaxiom/ghcr-cleanup-action@d52806a0dc70b430571a37da1fde39733ffd640f # v1.2.2 + with: + use-regex: true + delete-tags: '^sha-' + # Preserve every non-sha- tag. The colon check avoids matching digests. + exclude-tags: '^(?!sha-)[^:]+$' + delete-untagged: false + dry-run: ${{ inputs.dry_run }}