Skip to content

Commit 447704b

Browse files
committed
fix(pr): validate head SHA with bash regex so fork-CI runners without ripgrep pass the artifacts-init guard
1 parent 38e7ee9 commit 447704b

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

‎scripts/pr-lib/review.sh‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,10 @@ review_artifacts_init() {
160160
local meta_number head_sha
161161
meta_number=$(jq -r '.number' .local/pr-meta.json)
162162
head_sha=$(jq -r '.headRefOid' .local/pr-meta.json)
163-
if [ "$meta_number" != "$pr" ] || ! printf '%s' "$head_sha" | rg -q '^[0-9a-f]{40}$'; then
163+
# Bash regex, not rg: this guard runs inside fork-PR CI test harnesses on
164+
# GitHub-hosted runners without ripgrep, where a missing rg (exit 127) would
165+
# misreport a valid head SHA as an identity mismatch.
166+
if [ "$meta_number" != "$pr" ] || ! [[ "$head_sha" =~ ^[0-9a-f]{40}$ ]]; then
164167
echo "Review artifacts init failed: .local/pr-meta.json describes PR #$meta_number at '$head_sha', not PR #$pr. Re-run: scripts/pr review-init $pr"
165168
exit 1
166169
fi

0 commit comments

Comments
 (0)