publish.sh: surface PR-open and git-push failures as issue comments
ci / lint (pull_request) Successful in 13s

This commit is contained in:
2026-07-27 13:30:49 +00:00
parent eeae1fdaaa
commit c4fb117b93
+15 -2
View File
@@ -334,7 +334,15 @@ if [ -n "$(git status --porcelain)" ]; then
git add -A git add -A
git commit -m "@$NAME: issue #$NUM" git commit -m "@$NAME: issue #$NUM"
fi fi
git push origin "HEAD:$BRANCH" || true push_ok=0
if git push origin "HEAD:$BRANCH"; then
push_ok=1
else
status=$?
echo "git push failed for $BRANCH (exit $status)"
post "$(printf '⚠️ Push to branch `%s` failed (git exit %s). The PR will not open until the push succeeds. Please check the Actions log.' "$BRANCH" "$status")"
exit 0
fi
git fetch -q origin 2>/dev/null || true git fetch -q origin 2>/dev/null || true
prbody=$(printf '%s\n\n---\nResolves #%s' "$prdesc" "$NUM") prbody=$(printf '%s\n\n---\nResolves #%s' "$prdesc" "$NUM")
@@ -367,7 +375,12 @@ if [ -z "$url" ]; then
url=$(printf '%s' "$resp" | jq -r '.html_url // empty' 2>/dev/null) url=$(printf '%s' "$resp" | jq -r '.html_url // empty' 2>/dev/null)
prnum=$(printf '%s' "$resp" | jq -r '.number // empty' 2>/dev/null) prnum=$(printf '%s' "$resp" | jq -r '.number // empty' 2>/dev/null)
fi fi
[ -z "$url" ] && { echo "PR open/lookup failed for $br — posting reply on issue instead"; post "$(printf '%s%s' "$reply" "$activity")"; exit 0; } if [ -z "$url" ]; then
err_msg=$(printf '%s' "$resp" | jq -r 'if type=="object" and .message then .message else "(no error message in response)" end' 2>/dev/null)
echo "PR open/lookup failed for $br — response: $resp"
post "$(printf '⚠️ Failed to open PR for branch `%s`.%s\n\nGitea message: %s' "$br" "$activity" "$err_msg")"
exit 0
fi
# Posts to the PR thread when we have a PR number, else to the origin issue ($NUM). # Posts to the PR thread when we have a PR number, else to the origin issue ($NUM).
prpost() { prpost() {