Skip to content

Commit

Permalink
Merge pull request #72 from gruntwork-io/bug/jq-args-71
Browse files Browse the repository at this point in the history
Add handling of long PR comments
  • Loading branch information
denis256 authored May 24, 2024
2 parents a010536 + 0aa38a0 commit cf35563
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,11 @@ function comment {
log "Skipping comment as there is not comment url"
return
fi
local messagePayload
messagePayload=$(jq -n --arg body "$message" '{ "body": $body }')
curl -s -S -H "Authorization: token $GITHUB_TOKEN" -H "Content-Type: application/json" -d "$messagePayload" "$comment_url"
local -r escaped_message=$(printf '%s' "$message" | sed 's/\\/\\\\/g; s/"/\\"/g; s/$/\\n/g' | tr -d '\n')
local -r tmpfile=$(mktemp)
echo "{\"body\": \"$escaped_message\"}" > "$tmpfile"
curl -s -S -H "Authorization: token $GITHUB_TOKEN" -H "Content-Type: application/json" -d @"$tmpfile" "$comment_url"
rm "$tmpfile"
}

function setup_git {
Expand Down

0 comments on commit cf35563

Please sign in to comment.