fix: the release script checks its token on the repository
It asked Forgejo for the token's user, which needs the scope read:user; the token the script asks for only has write:repository, so the check would have refused a token that works. It now reads the repository itself, which that scope covers. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
This commit is contained in:
parent
4d3d4d9592
commit
b60752feff
1 changed files with 3 additions and 2 deletions
|
|
@ -196,8 +196,9 @@ forgejo_api() {
|
|||
curl --fail-with-body --silent --show-error \
|
||||
--config <(printf 'header = "Authorization: token %s"\n' "$token") "$@"
|
||||
}
|
||||
forgejo_api --output /dev/null "$forgejo/api/v1/user" ||
|
||||
fail "$forgejo doesn't take the token."
|
||||
# The token's scope, write:repository, covers the repository, not the account.
|
||||
forgejo_api --output /dev/null "$forgejo/api/v1/repos/$repository" ||
|
||||
fail "$forgejo doesn't take the token for $repository."
|
||||
[ "$(forgejo_api --output /dev/null --write-out '%{http_code}' \
|
||||
"$forgejo/api/v1/repos/$repository/releases/tags/$tag" 2>/dev/null || true)" = 404 ] ||
|
||||
fail "A release of $tag exists already on $forgejo. If only publishing it in the" \
|
||||
|
|
|
|||
Loading…
Reference in a new issue