fix(git): select USC Gitea login for PR merges (#516)
Some checks failed
ci/woodpecker/push/ci Pipeline failed
Some checks failed
ci/woodpecker/push/ci Pipeline failed
This commit is contained in:
@@ -91,6 +91,31 @@ get_remote_host() {
|
||||
return 1
|
||||
}
|
||||
|
||||
# Resolve the tea login name for the given Gitea host.
|
||||
# Priority: explicit caller override → known Mosaic host mapping → no forced login.
|
||||
get_gitea_login() {
|
||||
local host="$1"
|
||||
|
||||
if [[ -n "${GITEA_LOGIN:-}" ]]; then
|
||||
echo "$GITEA_LOGIN"
|
||||
return 0
|
||||
fi
|
||||
|
||||
case "$host" in
|
||||
git.mosaicstack.dev)
|
||||
echo "mosaicstack"
|
||||
return 0
|
||||
;;
|
||||
git.uscllc.com)
|
||||
echo "usc"
|
||||
return 0
|
||||
;;
|
||||
*)
|
||||
return 1
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
# Resolve a Gitea API token for the given host.
|
||||
# Priority: Mosaic credential loader → GITEA_TOKEN env → ~/.git-credentials
|
||||
get_gitea_token() {
|
||||
@@ -104,6 +129,10 @@ get_gitea_token() {
|
||||
local token
|
||||
token=$(
|
||||
source "$cred_loader"
|
||||
# load_credentials preserves pre-existing env vars by design. Clear
|
||||
# Gitea env in this subshell so host-specific credential lookup wins
|
||||
# over an ambient token for a different Gitea instance.
|
||||
unset GITEA_TOKEN GITEA_URL
|
||||
case "$host" in
|
||||
git.mosaicstack.dev) load_credentials gitea-mosaicstack 2>/dev/null ;;
|
||||
git.uscllc.com) load_credentials gitea-usc 2>/dev/null ;;
|
||||
|
||||
Reference in New Issue
Block a user