diff --git a/.github/workflows/gitlab-container-image-cleanup-pr-tag.yml b/.github/workflows/gitlab-container-image-cleanup-pr-tag.yml new file mode 100644 index 0000000..43a6b80 --- /dev/null +++ b/.github/workflows/gitlab-container-image-cleanup-pr-tag.yml @@ -0,0 +1,21 @@ +--- +name: Delete closed PR container image tag + +"on": + pull_request: + types: + - closed + +jobs: + cleanup-pr-tag: + uses: ubuntu-latest + steps: + - name: Set image version for PR to branch name + run: echo "VERSION=${GITHUB_HEAD_REF//\//-}" >> ${GITHUB_ENV} + + - name: Delete PR container image tag + uses: dataaxiom/ghcr-cleanup-action@v1 + with: + tags: ${{ env.VERSION }} + package: ${{ github.event.repository.name }}/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..f219a49 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.event.repository.name }}/gitlab + validate: true