diff --git a/.github/workflows/gitlab-container-image.yml b/.github/workflows/gitlab-container-image.yml index bf8af21..721cc8b 100644 --- a/.github/workflows/gitlab-container-image.yml +++ b/.github/workflows/gitlab-container-image.yml @@ -46,3 +46,11 @@ jobs: platforms: linux/amd64,linux/arm64 push: true tags: 'ghcr.io/${{ env.IMAGE }}:${{ env.VERSION }}' + + - name: Delete PR container image when PR is closed + if: github.event.pull_request.state == 'closed' + uses: dataaxiom/ghcr-cleanup-action@v1 + with: + tags: ${{ env.VERSION }} + package: ${{ github.repository }}/gitlab + token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/prune-old-container-images.yml b/.github/workflows/prune-old-container-images.yml index 641ef66..9a63bd7 100644 --- a/.github/workflows/prune-old-container-images.yml +++ b/.github/workflows/prune-old-container-images.yml @@ -1,5 +1,5 @@ --- -name: Prune old container images +name: Prune untagged container images "on": schedule: @@ -10,10 +10,8 @@ jobs: prune: runs-on: ubuntu-latest steps: - - uses: actions/delete-package-versions@v5 + - uses: dataaxiom/ghcr-cleanup-action@v1 with: - package-name: "${{ github.repository }}-gitlab" - package-type: container - # never delete release versions or latest - ignore-versions: "^(v.*|latest)$" - min-versions-to-keep: 3 + token: ${{ secrets.GITHUB_TOKEN }} + package: ${{ github.repository }}/gitlab + validate: true