File tree Expand file tree Collapse file tree 1 file changed +13
-5
lines changed
Expand file tree Collapse file tree 1 file changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -108,13 +108,21 @@ jobs:
108108
109109 echo "::group::Old release delete"
110110 RELEASE_ID=$(curl -s -H "Authorization: token $TOKEN" \
111- https://api.github.com/repos/$REPO/releases/tags/$TAG | jq -r .id )
111+ https://api.github.com/repos/$REPO/releases/tags/$TAG)
112112
113- if [ "$RELEASE_ID" != "null" ]; then
114- echo "Deleting release ID $RELEASE_ID"
115- curl -s -X DELETE -H "Authorization: token $TOKEN" \
116- https://api.github.com/repos/$REPO/releases/$RELEASE_ID
113+ MESSAGE=$(echo "$RELEASE_ID" | jq -r '.message // empty')
114+ if [ "$MESSAGE" = "Not Found" ]; then
115+ echo "Release with tag $TAG not found"
116+ else
117+ RELEASE_ID =$(echo "RELEASE_ID" | jq -r '.id // empty')
118+
119+ if [ "$RELEASE_ID" != "null" ]; then
120+ echo "Deleting release ID $RELEASE_ID"
121+ curl -s -X DELETE -H "Authorization: token $TOKEN" \
122+ https://api.github.com/repos/$REPO/releases/$RELEASE_ID
123+ fi
117124 fi
125+
118126 echo "::endgroup::"
119127
120128 echo "::group::Old tag delete"
You can’t perform that action at this time.
0 commit comments