Skip to content

Commit 861e8d6

Browse files
authored
Merge pull request #104038 from jldohmann/revert-script-and-template
[prow/ci] revert to old template and script
2 parents 7cb750f + 07231bf commit 861e8d6

File tree

2 files changed

+2
-19
lines changed

2 files changed

+2
-19
lines changed

.vale/templates/bot-comment-output.tmpl

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,7 @@
2929
{{- /* Variables setup */ -}}
3030
{{- $loc := printf "%d" .Line -}}
3131
{{- $check := printf "%s" .Check -}}
32-
{{- /* Escape special characters for valid JSON */ -}}
33-
{{- $message := replace "\\" "\\\\" (printf "%s" .Message) -}}
34-
{{- $message = replace "\"" "\\\"" $message -}}
35-
{{- $message = replace "\n" "\\n" $message -}}
36-
{{- $message = replace "\r" "\\r" $message -}}
37-
{{- $message = replace "\t" "\\t" $message -}}
32+
{{- $message := printf "%s" .Message -}}
3833
{{- /* Only add a link for RedHat rule errors */ -}}
3934
{{- $link := "" -}}
4035
{{- if contains "RedHat." .Check -}}

scripts/prow-vale-review.sh

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -23,19 +23,7 @@ function post_review_comment {
2323
BODY=$1
2424
FILENAME=$2
2525
echo "Sending review comment curl request..."
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"
38-
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"}'
3927
}
4028

4129
function get_vale_errors {

0 commit comments

Comments
 (0)