ci(release): authenticate Forgejo API with HTTP Basic
Bearer is rejected on this instance (403/1010). Use sirius + token, matching the dispatch path that actually works.
This commit is contained in:
parent
10d81964a5
commit
dc52df2366
3 changed files with 11 additions and 11 deletions
|
|
@ -86,7 +86,7 @@ jobs:
|
|||
api_curl() {
|
||||
curl -sS --http1.1 --retry 5 --retry-all-errors --retry-delay 3 \
|
||||
--connect-timeout 20 --max-time 60 \
|
||||
-H "Authorization: Bearer $FORGEJO_TOKEN" "$@"
|
||||
-u "sirius:${FORGEJO_TOKEN}" "$@" | sed 's/\r$//'
|
||||
}
|
||||
|
||||
input_tag="${INPUT_TAG:-}"
|
||||
|
|
@ -430,19 +430,19 @@ jobs:
|
|||
FORGEJO_TOKEN=$(printf '%s' "$FORGEJO_TOKEN" | tr -d '\r\n')
|
||||
echo "fail-closed: removing tag $TAG created by this run"
|
||||
code=$(curl -sS --http1.1 -o /tmp/rel.json -w '%{http_code}' \
|
||||
-H "Authorization: Bearer ${FORGEJO_TOKEN}" \
|
||||
-u "sirius:${FORGEJO_TOKEN}" \
|
||||
"$REPO_API/releases/tags/$TAG")
|
||||
if [ "$code" = "200" ]; then
|
||||
rid=$(python3 -c "import json; print(json.load(open('/tmp/rel.json'))['id'])")
|
||||
echo "deleting incomplete release id $rid"
|
||||
curl -sS --http1.1 -X DELETE \
|
||||
-H "Authorization: Bearer ${FORGEJO_TOKEN}" \
|
||||
-u "sirius:${FORGEJO_TOKEN}" \
|
||||
"$REPO_API/releases/$rid" -o /dev/null -w "DELETE release HTTP %{http_code}\n"
|
||||
else
|
||||
echo "no release for $TAG (HTTP $code)"
|
||||
fi
|
||||
del=$(curl -sS --http1.1 -o /tmp/tag-del.json -w '%{http_code}' -X DELETE \
|
||||
-H "Authorization: Bearer ${FORGEJO_TOKEN}" \
|
||||
-u "sirius:${FORGEJO_TOKEN}" \
|
||||
"$REPO_API/tags/$TAG")
|
||||
echo "DELETE tag HTTP $del"
|
||||
if [ "$del" != "204" ] && [ "$del" != "404" ]; then
|
||||
|
|
|
|||
Loading…
Reference in a new issue