Skip to content

Commit 040b282

Browse files
authored
actions: use real newlines in close-failing-ci-prs comment bodies (hashicorp#32090)
1 parent 0b7107a commit 040b282

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

scripts/close-failing-ci-prs.sh

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ build_guidance() {
250250
return
251251
fi
252252

253-
local guidance="\\n\\n**Failing checks and how to fix them:**\\n"
253+
local guidance=$'\n\n**Failing checks and how to fix them:**\n'
254254
local seen=""
255255

256256
IFS=',' read -ra checks <<< "$failed_checks"
@@ -263,7 +263,8 @@ build_guidance() {
263263

264264
local fix
265265
fix=$(get_check_guidance "$check")
266-
guidance="${guidance}\\n- **${check}**: ${fix}"
266+
guidance="${guidance}
267+
- **${check}**: ${fix}"
267268
done
268269

269270
echo "$guidance"
@@ -348,7 +349,12 @@ for pr in "${all_prs[@]}"; do
348349
echo " ↳ CI failing for ${days_since} days -> CLOSING"
349350

350351
if [[ "$DRY_RUN" == "false" ]]; then
351-
comment_body="${WARNING_MARKER}\nThank you for your contribution @${pr_author}. Unfortunately, we are unable to review or merge this pull request as the CI checks have been failing for more than 14 days.\n\nPlease feel free to reopen this PR once the CI issues have been resolved.${guidance}\n\nThank you for your understanding!"
352+
comment_body="${WARNING_MARKER}
353+
Thank you for your contribution @${pr_author}. Unfortunately, we are unable to review or merge this pull request as the CI checks have been failing for more than 14 days.
354+
355+
Please feel free to reopen this PR once the CI issues have been resolved.${guidance}
356+
357+
Thank you for your understanding!"
352358

353359
# Use jq to safely build JSON
354360
json_payload=$(jq -n --arg body "$comment_body" '{"body": $body}')
@@ -384,7 +390,12 @@ for pr in "${all_prs[@]}"; do
384390
echo " ↳ CI failing for ${days_since} days -> WARNING"
385391

386392
if [[ "$DRY_RUN" == "false" ]]; then
387-
comment_body="${WARNING_MARKER}\nHi @${pr_author}, we have noticed that the CI on this pull request has been failing for 7 days.\n\nIf the CI failures are not resolved within the next 7 days, we will close this pull request.${guidance}\n\nIf you need help, please leave a comment and we will do our best to assist. Thank you!"
393+
comment_body="${WARNING_MARKER}
394+
Hi @${pr_author}, we have noticed that the CI on this pull request has been failing for 7 days.
395+
396+
If the CI failures are not resolved within the next 7 days, we will close this pull request.${guidance}
397+
398+
If you need help, please leave a comment and we will do our best to assist. Thank you!"
388399

389400
json_payload=$(jq -n --arg body "$comment_body" '{"body": $body}')
390401

0 commit comments

Comments
 (0)