-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Escape multiline string #259
Conversation
Would love your review on this one since you reviewed #257 |
Closing this PR and opening one from my fork instead: |
local flag="-R" | ||
if [ "$2" = "stream" ]; then | ||
flag="-sR" | ||
fi | ||
echo "$1" | jq ${flag} -c . | grep -E '^".*"$' | awk '{print substr($0, 2, length($0) - 2)}' && [ "${PIPESTATUS[2]}" -eq 0 ] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see no reason to differentiate between a single-line string and a multi-line string. The behavior is the same either way for a single-line string, and is an improvement for a multi-line string. Why not just treat it as multi-line unconditionally?
local flag="-R" | |
if [ "$2" = "stream" ]; then | |
flag="-sR" | |
fi | |
echo "$1" | jq ${flag} -c . | grep -E '^".*"$' | awk '{print substr($0, 2, length($0) - 2)}' && [ "${PIPESTATUS[2]}" -eq 0 ] | |
echo "$1" | jq -sR -c . | grep -E '^".*"$' | awk '{print substr($0, 2, length($0) - 2)}' && [ "${PIPESTATUS[2]}" -eq 0 ] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@KyleFromNVIDIA left a comment here.
@@ -75,7 +79,7 @@ jobs: | |||
echo "repo=$(escape_json "${REPO}")" >> $GITHUB_OUTPUT | |||
echo "pr_number=${PR_NUMBER}" >> $GITHUB_OUTPUT | |||
echo "pr_title=$(escape_json "${PR_TITLE}")" >> $GITHUB_OUTPUT | |||
echo "pr_body=$(escape_json "${PR_BODY}")" >> $GITHUB_OUTPUT | |||
echo "pr_body=$(escape_json "${PR_BODY}" stream)" >> $GITHUB_OUTPUT |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
echo "pr_body=$(escape_json "${PR_BODY}" stream)" >> $GITHUB_OUTPUT | |
echo "pr_body=$(escape_json "${PR_BODY}")" >> $GITHUB_OUTPUT |
Fixes a small issue with multiline strings passed to
pr_body
here.Follow up PR to #257