Skip to content

fix(ci): correct markdown structure of the issue-linking failure comment - #37093

Open
nollymar wants to merge 1 commit into
mainfrom
claude/pr-issue-linking-indents-6977f7
Open

fix(ci): correct markdown structure of the issue-linking failure comment#37093
nollymar wants to merge 1 commit into
mainfrom
claude/pr-issue-linking-indents-6977f7

Conversation

@nollymar

@nollymar nollymar commented Aug 18, 2026

Copy link
Copy Markdown
Member

What

The "❌ Issue Linking Required" comment that this repo's link-issue check posts on unlinked PRs rendered with broken markdown:

  • the Option 3 heading was swallowed into Option 2's numbered list (showing up as a bogus list item)
  • stray blank lines split the bullet/numbered lists apart
  • the --- separator and the italic footer were glued onto the "Why is this required?" paragraph (…they solve.---*This comment…*)
  • ~30 garbage trailing newlines

Why

The comment body was built with a single printf whose format string had 21 %s slots for 22 arguments, and whose \n/\n\n group boundaries did not line up with the argument groups. With more args than slots, bash reuses the format string, producing the glued footer and trailing newlines. This is the second time this printf drifted out of alignment (a bullet was added without adding a format slot), so this PR removes the fragile pattern instead of re-aligning it.

How

Replaced the printf in the "Add failure comment to PR" step with a quoted heredoc holding the literal markdown. Wording is unchanged; only blank-line structure is corrected. The ## ❌ Issue Linking Required header is byte-identical, so the dedup check and the "Remove failure comment if issue is now resolved" step keep matching (stale broken comments still get cleaned up). The quoted delimiter keeps the body non-interpolating, so no injection surface is added.

Verification

  • Extracted the step's script through a YAML parser and executed it: body renders flush-left, lists contiguous, blank lines before every heading/list, --- standalone, no trailing garbage.
  • Rendered the body through GitHub's GFM API (gh api /markdown): Option 3 is a paragraph outside the <ol>, one 3-item ordered list, two bullet lists, standalone <hr>, italic footer, no empty list items.
  • actionlint: no new findings vs main; drops one (SC2183, shellcheck's own warning about the printf slot/argument mismatch).
  • Live check: this PR is intentionally opened without a linked issue, so the check runs the PR branch's version of the workflow and posts the failure comment itself — inspect it to confirm the fixed rendering. An issue will be linked afterward to turn the check green.

🤖 Generated with Claude Code

This PR fixes #37100

The "Issue Linking Required" PR comment was built with a printf whose
format string had 21 %s slots for 22 arguments, and whose blank-line
boundaries did not match the argument groups. On GitHub this rendered
with broken lists (the Option 3 heading swallowed into the numbered
list), stray blank bullets, the footer glued onto the last paragraph,
and trailing garbage newlines from bash reusing the format string.

Replace the printf with a quoted heredoc holding the literal markdown.
Wording is unchanged; only the blank-line structure is corrected. The
"Issue Linking Required" header stays byte-identical so the dedup check
and the auto-removal step keep matching existing comments.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@nollymar
nollymar requested a review from a team as a code owner August 18, 2026 04:26
@nollymar
nollymar requested a review from mbiuki August 18, 2026 04:27
@github-actions github-actions Bot added the Area : CI/CD PR changes GitHub Actions/workflows label Aug 18, 2026
@claude

claude Bot commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Claude finished @nollymar's task in 1m 25s —— View job


Code Review

Reviewed the diff in .github/workflows/issue_comp_link-issue-to-pr.yml (the "Add failure comment to PR" step).

  • Analyze diff
  • Verify heredoc indentation / YAML dedent behavior
  • Verify JSON escaping into the curl payload
  • Verify dedup & cleanup steps still match the header

Findings

No issues found.

The printf → quoted-heredoc swap is correct and lower-risk than the original:

  • Indentation is safe. Every heredoc line (content, delimiters, and the closing COMMENT_EOF) sits at a uniform 10-space indent inside the run: | literal block. YAML strips that common indentation uniformly, so the body reaches bash flush-left — no accidental 4-space markdown code-block indentation, and the closing delimiter matches at column 0. (.github/workflows/issue_comp_link-issue-to-pr.yml:581-618)
  • No injection surface added. The quoted delimiter (<<'COMMENT_EOF') disables interpolation, so literal `Fixes #123`, $, and org/repo#123 in the body are not expanded. (:581)
  • JSON is escaped correctly. The body is fed through jq -R -s . before being placed in -d, so newlines/quotes/backticks are properly encoded — the heredoc's real newlines survive the round-trip. (:626)
  • Dedup + cleanup still work. Both the dedup guard (:572) and the "Remove failure comment if issue is now resolved" step (:270) match on contains("❌ Issue Linking Required"), and the header at :582 still contains that exact substring — stale broken comments continue to be detected and cleaned up. (:270, :572, :582)

Wording is unchanged; only blank-line/list structure is corrected. The removal of the fragile 21-slot/22-arg printf also clears the SC2183 shellcheck warning, matching the PR description.

· claude/pr-issue-linking-indents-6977f7

@mbiuki
mbiuki added this pull request to the merge queue Aug 18, 2026
@nollymar
nollymar removed this pull request from the merge queue due to a manual request Aug 18, 2026
@nollymar
nollymar added this pull request to the merge queue Aug 18, 2026
@nollymar
nollymar removed this pull request from the merge queue due to a manual request Aug 18, 2026
@nollymar
nollymar added this pull request to the merge queue Aug 18, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to no response for status checks Aug 18, 2026
@nollymar
nollymar added this pull request to the merge queue Aug 19, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Aug 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AI: Safe To Rollback Area : CI/CD PR changes GitHub Actions/workflows

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

Issue-linking failure comment renders with broken markdown

2 participants