From 252bac6380ee21ed22b12861f75844a8be2321ec Mon Sep 17 00:00:00 2001 From: jlestel Date: Tue, 21 Nov 2023 13:37:06 +0100 Subject: [PATCH] token: ${{ secrets.GITHUB_TOKEN }} --- .github/workflows/ghcr_purge.yml | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/.github/workflows/ghcr_purge.yml b/.github/workflows/ghcr_purge.yml index a6c9d3bc23..4dc386b326 100644 --- a/.github/workflows/ghcr_purge.yml +++ b/.github/workflows/ghcr_purge.yml @@ -10,26 +10,25 @@ permissions: packages: write jobs: - purge-pr-untagged: - name: Delete untagged images from ghcr.io + purge-pr-package: + name: Delete images from ghcr.io when PR is closed runs-on: ubuntu-latest - steps: + - uses: chipkent/action-cleanup-package@v1.0.1 + name: Delete PR image from ghcr.io + id: cleanup + continue-on-error: true + with: + package-name: ${{ github.event.repository.name }} + tag: pr-${{ github.event.pull_request.number }} + github-token: ${{ secrets.GITHUB_TOKEN }} - uses: actions/delete-package-versions@v4 + if: job.steps.cleanup.status == success() + name: Delete untagged images from ghcr.io + continue-on-error: true with: package-name: "teslamate" package-type: "container" min-versions-to-keep: 0 delete-only-untagged-versions: "true" token: ${{ secrets.GITHUB_TOKEN }} - - purge-pr-package: - name: Delete image from ghcr.io - runs-on: ubuntu-latest - - steps: - - uses: chipkent/action-cleanup-package@v1.0.1 - with: - package-name: ${{ github.event.repository.name }} - tag: pr-${{ github.event.pull_request.number }} - github-token: ${{ secrets.GITHUB_TOKEN }}