delete-asset.sh: compare rather raw JSON string

This commit is contained in:
Martin Pulec
2020-04-03 11:53:42 +02:00
parent ee974c7764
commit cc85548cfb

View File

@@ -9,8 +9,8 @@ RELEASE_ID=$(echo "$JSON" | jq -r '.id')
JSON=$(fetch_json https://api.github.com/repos/$GITHUB_REPOSITORY/releases/$RELEASE_ID/assets $GITHUB_TOKEN array)
LEN=$(echo "$JSON" | jq length)
for n in `seq 0 $(($LEN-1))`; do
NAME=$(echo "$JSON" | jq '.['$n'].name')
if expr "$NAME" : "\"$PATTERN\"$"; then
NAME=$(echo "$JSON" | jq -r '.['$n'].name')
if expr "$NAME" : "$PATTERN$"; then
ID=$(echo "$JSON" | jq '.['$n'].id')
TMPNAME=$(mktemp)
STATUS=$(curl -S -H "Authorization: token $GITHUB_TOKEN" -X DELETE "https://api.github.com/repos/$GITHUB_REPOSITORY/releases/assets/$ID" -w %{http_code} -o $TMPNAME)