File tree Expand file tree Collapse file tree 1 file changed +1
-30
lines changed
Expand file tree Collapse file tree 1 file changed +1
-30
lines changed Original file line number Diff line number Diff line change @@ -20,40 +20,11 @@ jobs:
2020 echo "Repository name is: $REPOSITORY_NAME"
2121 echo "REPOSITORY_NAME=$REPOSITORY_NAME" >> $GITHUB_ENV
2222
23- - name : Delete untagged images
23+ - name : Delete untagged Docker images
2424 uses : Chizkiyahu/delete-untagged-ghcr-action@v4
2525 with :
2626 token : ${{ secrets.GHCR_ACCESS_TOKEN }}
2727 owner_type : user
2828 package_name : ${{ env.REPOSITORY_NAME }}
2929 untagged_only : true
3030
31- docker :
32- runs-on : ubuntu-latest
33-
34- steps :
35- - name : Get repository name
36- run : |
37- REPOSITORY_NAME="${{ github.repository }}"
38- REPOSITORY_NAME="${REPOSITORY_NAME##*/}"
39- echo "Repository name is: $REPOSITORY_NAME"
40- echo "REPOSITORY_NAME=$REPOSITORY_NAME" >> $GITHUB_ENV
41-
42- - name : Download regctl
43- run : |
44- curl -sSL https://github.com/regclient/regclient/releases/latest/download/regctl-linux-amd64 -o regctl
45- chmod +x ./regctl
46-
47- - name : Registry login
48- run : |
49- ./regctl registry login docker.io -u "${{ vars.DOCKER_IO_USER }}" -p "${{ secrets.DOCKER_IO_ACCESS_TOKEN }}"
50-
51- - name : Delete untagged images
52- run : |
53- ./regctl artifact list "docker.io/${{ vars.DOCKER_IO_USER }}/${{ env.REPOSITORY_NAME }}" --format json | \
54- jq -r '.[] | select(.tags == null or .tags | length == 0) | .digest' | \
55- while read digest; do
56- echo "Deleting untagged digest: $digest"
57- ./regctl manifest rm "docker.io/${{ vars.DOCKER_IO_USER }}/${{ env.REPOSITORY_NAME }}@$digest"
58- done
59-
You can’t perform that action at this time.
0 commit comments