Conversation
Agent-Logs-Url: https://github.com/github/gh-aw/sessions/4807312c-bc5c-485d-9852-eb4e71c1d72b Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Agent-Logs-Url: https://github.com/github/gh-aw/sessions/4807312c-bc5c-485d-9852-eb4e71c1d72b Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR fixes malformed Markdown rendering when a security-scanning caution block (> [!CAUTION]) is injected into the generated footer for add_comment output by ensuring the footer starts on a new paragraph boundary.
Changes:
- Add explicit paragraph separation before appending
generateFooterWithMessages(...)inadd_comment.cjs. - Add a regression test to assert a blank line exists before the injected caution block and that the caution appears before the attribution footer.
Show a summary per file
| File | Description |
|---|---|
| actions/setup/js/add_comment.cjs | Prepends a paragraph break before appending the generated footer to avoid admonition/blockquote Markdown attaching to user content. |
| actions/setup/js/add_comment.test.cjs | Adds assertions to verify correct spacing and ordering for the injected security-scanning caution block in comment bodies. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 2/2 changed files
- Comments generated: 1
| if (includeFooter) { | ||
| // When footer is enabled, add full footer with attribution and XML markers | ||
| processedBody += generateFooterWithMessages(workflowName, runUrl, workflowSource, workflowSourceURL, triggeringIssueNumber, triggeringPRNumber, triggeringDiscussionNumber, historyUrl).trimEnd(); | ||
| processedBody += "\n\n" + generateFooterWithMessages(workflowName, runUrl, workflowSource, workflowSourceURL, triggeringIssueNumber, triggeringPRNumber, triggeringDiscussionNumber, historyUrl).trimEnd(); |
There was a problem hiding this comment.
generateFooterWithMessages(...) already starts with "\n\n" when there are no guard notices (i.e., the common non-warning case). Prepending another "\n\n" here changes the rendered output to include two blank paragraphs ("\n\n\n\n") before the normal attribution footer, which is a behavior change unrelated to the caution/admonition fix. Consider building the footer string first and only inserting an extra separator when the footer/guard content does not already begin on a new-paragraph boundary (e.g., when detection caution is present and the footer starts with "> [!CAUTION]").
| processedBody += "\n\n" + generateFooterWithMessages(workflowName, runUrl, workflowSource, workflowSourceURL, triggeringIssueNumber, triggeringPRNumber, triggeringDiscussionNumber, historyUrl).trimEnd(); | |
| const footerWithMessages = generateFooterWithMessages( | |
| workflowName, | |
| runUrl, | |
| workflowSource, | |
| workflowSourceURL, | |
| triggeringIssueNumber, | |
| triggeringPRNumber, | |
| triggeringDiscussionNumber, | |
| historyUrl, | |
| ).trimEnd(); | |
| processedBody += footerWithMessages.startsWith("\n\n") || footerWithMessages.startsWith("\r\n\r\n") | |
| ? footerWithMessages | |
| : "\n\n" + footerWithMessages; |
🧪 Test Quality Sentinel ReportTest Quality Score: 80/100✅ Excellent test quality
Test Classification DetailsView test details
Analysis: New Test✅
|
There was a problem hiding this comment.
✅ Test Quality Sentinel: 80/100. Test quality is excellent — 0% of new tests are implementation tests (threshold: 30%). The single new test directly verifies the behavioral contract of the one-line markdown fix and exercises a non-default security-warning code path.
Injected security-scanning cautions could render as malformed markdown when appended directly after user content in
safeoutputs/add_comment. The generated caution/footer block now starts on a guaranteed new paragraph boundary.Root cause
add_comment.cjsappendedgenerateFooterWithMessages(...).trimEnd()directly toprocessedBodywith no separator.> [!CAUTION]block, blockquote/admonition syntax could attach to preceding text.Change
add_comment.cjs:processedBody += "\n\n" + generateFooterWithMessages(...).trimEnd();Regression coverage
add_comment.test.cjsassertions to verify:> [!CAUTION],