File tree Expand file tree Collapse file tree 1 file changed +0
-31
lines changed
Expand file tree Collapse file tree 1 file changed +0
-31
lines changed Original file line number Diff line number Diff line change 5050 platforms : linux/amd64,linux/arm64
5151 cache-from : type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:cache
5252 cache-to : type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:cache,mode=max
53-
54- cleanup :
55- needs : build-and-push
56- runs-on : ubuntu-latest
57- steps :
58- - name : Checkout repo
59- uses : actions/checkout@v3
60-
61- - name : Install jq
62- run : sudo apt-get update && sudo apt-get install -y jq
63-
64- - name : Cleanup untagged versions
65- env :
66- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
67- OWNER : ${{ github.repository_owner }}
68- PACKAGE : synpage
69- ORG_PAT : ${{ secrets.ORG_PAT }}
70- run : |
71- echo "$ORG_PAT" | gh auth login --with-token
72-
73- # タグなしバージョンIDを取得
74- VERSIONS=$(gh api -H "Accept: application/vnd.github+json" \
75- "/users/${OWNER}/packages/container/${PACKAGE}/versions" \
76- --paginate | jq '.[] | select(.metadata.container.tags | length == 0) | .id')
77-
78- # 削除処理
79- for VERSION_ID in ${VERSIONS}; do
80- echo "Deleting version ID: ${VERSION_ID}"
81- gh api -X DELETE -H "Accept: application/vnd.github+json" \
82- "/users/${OWNER}/packages/container/${PACKAGE}/versions/${VERSION_ID}"
83- done
You can’t perform that action at this time.
0 commit comments