[CI] Fix bot-cherry-pick: use state == "MERGED" instead of invalid merged field (#25987)

This commit is contained in:
Kangyan-Zhou
2026-05-21 20:10:12 +08:00
committed by GitHub
parent fbebdd5105
commit 32352f7edf
+2 -3
View File
@@ -89,13 +89,12 @@ jobs:
PR_URL=""
if [[ -n "$PR_NUMBER" ]]; then
if ! PR_JSON=$(gh pr view "$PR_NUMBER" --repo "$GITHUB_REPOSITORY" --json state,merged,mergeCommit,title,number,url); then
if ! PR_JSON=$(gh pr view "$PR_NUMBER" --repo "$GITHUB_REPOSITORY" --json state,mergeCommit,title,number,url); then
echo "::error::Failed to fetch PR #$PR_NUMBER from $GITHUB_REPOSITORY (see gh output above)."
exit 1
fi
MERGED=$(jq -r '.merged' <<<"$PR_JSON")
STATE=$(jq -r '.state' <<<"$PR_JSON")
if [[ "$MERGED" != "true" ]]; then
if [[ "$STATE" != "MERGED" ]]; then
echo "::error::PR #$PR_NUMBER is not merged (state=$STATE). Only merged PRs can be cherry-picked."
exit 1
fi