fix(ci): escape regex \s and \b as JSON string literals in jq filter
PR Ready Gate / clear-labels (pull_request) Successful in 2s
CI / review-gate (pull_request) Successful in 7s
CI / review (anthropic--claude-4.6-sonnet, sonnet, SONNET_REVIEW_TOKEN) (pull_request) Has been skipped
CI / review (gpt-5, gpt, GPT_REVIEW_TOKEN) (pull_request) Has been skipped
CI / review (gpt-5, security, ., rodin/security-patterns, SECURITY_REVIEW.md, SECURITY_REVIEW_TOKEN) (pull_request) Has been skipped
CI / test (pull_request) Successful in 22s
PR Ready Gate / clear-labels (pull_request) Successful in 2s
CI / review-gate (pull_request) Successful in 7s
CI / review (anthropic--claude-4.6-sonnet, sonnet, SONNET_REVIEW_TOKEN) (pull_request) Has been skipped
CI / review (gpt-5, gpt, GPT_REVIEW_TOKEN) (pull_request) Has been skipped
CI / review (gpt-5, security, ., rodin/security-patterns, SECURITY_REVIEW.md, SECURITY_REVIEW_TOKEN) (pull_request) Has been skipped
CI / test (pull_request) Successful in 22s
jq parses the test() argument as a JSON string, so \s and \b must be double-escaped (\\s, \\b) to produce literal \s and \b after JSON string parsing. Single backslash forms are invalid JSON escapes and cause a compile error.
This commit is contained in:
@@ -58,7 +58,7 @@ jobs:
|
||||
TTL_MIN=${SELF_REVIEW_TTL_MIN}
|
||||
|
||||
COMMENTS=$(curl -sS -H "Authorization: token $GITEA_TOKEN" "$API/repos/$REPO/issues/$PR/comments?limit=200")
|
||||
HAS_SR=$(echo "$COMMENTS" | jq -r --arg sha "$SHA" '[.[] | select(.user.login=="rodin") | select(.body|contains("Self-review against "+$sha)) | select(.body|test("(?im)^###\s+Doc consistency\b"))] | length')
|
||||
HAS_SR=$(echo "$COMMENTS" | jq -r --arg sha "$SHA" '[.[] | select(.user.login=="rodin") | select(.body|contains("Self-review against "+$sha)) | select(.body|test("(?im)^###\\s+Doc consistency\\b"))] | length')
|
||||
|
||||
if [ "$HAS_SR" -gt 0 ]; then
|
||||
ALLOW=true
|
||||
|
||||
Reference in New Issue
Block a user