Skip to content

Commit 0189c71

Browse files
authored
Merge pull request #103826 from maxwelldb/test-prow-review-change
[prow/ci] Test prow review change
2 parents f73829a + 7538e2f commit 0189c71

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

scripts/prow-vale-review.sh

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,18 @@ function post_review_comment {
2323
BODY=$1
2424
FILENAME=$2
2525
echo "Sending review comment curl request..."
26-
curl -L -X POST -H "Accept: application/vnd.github+json" -H "Authorization: Bearer $GITHUB_AUTH_TOKEN" -H "X-GitHub-Api-Version: 2022-11-28" https://api.github.com/repos/openshift/openshift-docs/pulls/$PULL_NUMBER/comments -d '{"body":"'"$BODY"'","commit_id":"'"$COMMIT_ID"'","path":"'"$FILENAME"'","line":'"$LINE_NUMBER"',"side":"RIGHT"}'
26+
# Use jq to excruciatingly craft JSON payload
27+
# jq -n because we're constructing from scratch per https://jqlang.org/manual/
28+
# --arg for string, --argjson for integer
29+
# body constructed from https://docs.github.com/en/rest/pulls/comments?apiVersion=2022-11-28#create-a-review-comment-for-a-pull-request
30+
payload=$(jq -n \
31+
--arg body "$BODY" \
32+
--arg commit_id "$COMMIT_ID" \
33+
--arg path "$FILENAME" \
34+
--argjson line "$LINE_NUMBER" \
35+
'{body: $body, commit_id: $commit_id, path: $path, line: $line, side: "RIGHT"}')
36+
echo "DEBUG payload:" "$payload"
37+
curl -L -X POST -H "Accept: application/vnd.github+json" -H "Authorization: Bearer $GITHUB_AUTH_TOKEN" -H "X-GitHub-Api-Version: 2022-11-28" https://api.github.com/repos/openshift/openshift-docs/pulls/$PULL_NUMBER/comments -d "$payload"
2738

2839
}
2940

0 commit comments

Comments
 (0)