Skip to content

Commit 170a5b4

Browse files
committed
fix: treat null gitee release id as missing
1 parent 020e5b8 commit 170a5b4

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

.github/scripts/sync-release-to-gitee.sh

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,17 @@ urlencode() {
2727

2828
gitee_release_id_by_tag() {
2929
local tag="$1"
30-
local tag_q tmp code
30+
local tag_q tmp code rid
3131
tag_q="$(urlencode "${tag}")"
3232
tmp="$(mktemp)"
3333
code="$(curl -sS -o "${tmp}" -w "%{http_code}" "${API_BASE}/releases/tags/${tag_q}?access_token=${GITEE_TOKEN}")"
3434
if [[ "${code}" == "200" ]]; then
35-
jq -r '.id' "${tmp}"
36-
rm -f "${tmp}"
37-
return 0
35+
rid="$(jq -r '.id // empty' "${tmp}")"
36+
if [[ -n "${rid}" && "${rid}" != "null" ]]; then
37+
echo "${rid}"
38+
rm -f "${tmp}"
39+
return 0
40+
fi
3841
fi
3942
rm -f "${tmp}"
4043
return 1
@@ -200,4 +203,3 @@ case "${MODE}" in
200203
exit 1
201204
;;
202205
esac
203-

0 commit comments

Comments
 (0)