From b7da21063ec44a0bcddac03fe24f90a16bf88101 Mon Sep 17 00:00:00 2001 From: agent-dev-b Date: Sat, 23 May 2026 21:56:43 +0000 Subject: [PATCH] fix(ci): guard review-check against empty PRs (head == base) (#1743) Co-authored-by: agent-dev-b Co-committed-by: agent-dev-b --- .gitea/scripts/review-check.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.gitea/scripts/review-check.sh b/.gitea/scripts/review-check.sh index 61e445ad..ad526bbc 100755 --- a/.gitea/scripts/review-check.sh +++ b/.gitea/scripts/review-check.sh @@ -128,6 +128,7 @@ fi PR_AUTHOR=$(jq -r '.user.login // ""' "$PR_JSON") PR_HEAD_SHA=$(jq -r '.head.sha // ""' "$PR_JSON") PR_BASE_REF=$(jq -r '.base.ref // ""' "$PR_JSON") +PR_BASE_SHA=$(jq -r '.base.sha // ""' "$PR_JSON") PR_STATE=$(jq -r '.state // ""' "$PR_JSON") DEFAULT_BRANCH="${DEFAULT_BRANCH:-main}" debug "pr_author=${PR_AUTHOR} pr_head=${PR_HEAD_SHA:0:7} pr_base=${PR_BASE_REF} pr_state=${PR_STATE}" @@ -136,6 +137,10 @@ if [ "$PR_STATE" != "open" ]; then echo "::notice::PR ${PR_NUMBER} is ${PR_STATE} — exiting 0 (closed PRs do not gate)" exit 0 fi +if [ "$PR_HEAD_SHA" = "$PR_BASE_SHA" ]; then + echo "::notice::PR ${PR_NUMBER} has no diff (head == base) — exiting 0 (empty PRs do not gate)" + exit 0 +fi if [ "$PR_BASE_REF" != "$DEFAULT_BRANCH" ]; then echo "::notice::PR ${PR_NUMBER} targets ${PR_BASE_REF:-} not ${DEFAULT_BRANCH} — ${TEAM}-review gate not applicable" exit 0