-
Notifications
You must be signed in to change notification settings - Fork 65
Description
Describe the bug
I've just had a run --all plan run fail to add a comment to the PR. The response from GitHub appeared to be:
{
"message": "Problems parsing JSON",
"documentation_url": "https://docs.github.com/rest/issues/comments#create-an-issue-comment",
"status": "400"
}Looking at the code, I'd guess that this line is naive?
Line 92 in aee21a7
| local -r escaped_message=$(printf '%s' "$message" | sed 's/\\/\\\\/g; s/"/\\"/g; s/$/\\n/g; s/\t/\\t/g' | tr -d '\n') |
A better method is probably to get jq, which is already used a few lines earlier, to produce the JSON and pipe it into curl (like this: https://github.com/wjam/dotfiles/blob/6569ac73e6447611d8425f742d22e3d4b7900df2/home/private_dot_local/bin/executable_lights#L27-L28)?
To Reproduce
Difficult to reproduce - clearly something in the resulting log files managed to produce invalid JSON string, but it's difficult to say what without sharing the plan output (which is private).
Expected behavior
A comment should be added to the PR.
Nice to have
- Terminal output
- Screenshots
Versions
- Terragrunt Action version: v2.1.8
- Environment details (Terragrunt version, Terraform version, etc.): Terragrunt 0.83.2, Terraform 1.9.5
Additional context