Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion scripts/prow-vale-review.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,18 @@ function post_review_comment {
BODY=$1
FILENAME=$2
echo "Sending review comment curl request..."
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"}'
# Use jq to excruciatingly craft JSON payload
# jq -n because we're constructing from scratch per https://jqlang.org/manual/
# --arg for string, --argjson for integer
# body constructed from https://docs.github.com/en/rest/pulls/comments?apiVersion=2022-11-28#create-a-review-comment-for-a-pull-request
payload=$(jq -n \
--arg body "$BODY" \
--arg commit_id "$COMMIT_ID" \
--arg path "$FILENAME" \
--argjson line "$LINE_NUMBER" \
'{body: $body, commit_id: $commit_id, path: $path, line: $line, side: "RIGHT"}')
echo "DEBUG payload:" "$payload"
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"

}

Expand Down