Skip to content

feat: first-class PR comment markdown via --pr-comment-output#289

Open
aidenybai wants to merge 1 commit into
cursor/baseline-and-touched-lines-675bfrom
cursor/pr-comment-markdown-675b
Open

feat: first-class PR comment markdown via --pr-comment-output#289
aidenybai wants to merge 1 commit into
cursor/baseline-and-touched-lines-675bfrom
cursor/pr-comment-markdown-675b

Conversation

@aidenybai
Copy link
Copy Markdown
Member

Third and final PR of the #286 split. Stacked on #288 (cursor/baseline-and-touched-lines-675b), which is itself stacked on #287. Merge order: #287#288 → this PR.

What's new

--pr-comment-output <path>

react-doctor . --pr-comment --pr-comment-output ./comment.md | tee ./build-log.txt

One scan, two outputs:

  • stdout — the legacy --pr-comment plaintext for the build log.
  • file — a sticky-PR-comment-ready markdown document written as a side effect.

The action.yml previously had to invoke npx react-doctor@latest twice (once for plaintext, once for markdown). Now it's a single invocation.

buildPrCommentMarkdown(report) — structured rendering

  • Leading <!-- react-doctor --> marker so a GitHub Action comment-updater can idempotently replace its previous post.
  • Per-rule <details> groups with severity icons, file:line references, and copy-pasteable // eslint-disable-next-line … suppression snippets.
  • Per-package summary block for monorepos (worst-scored project drives the headline).
  • Baseline-aware framing — "no new violations introduced by this PR" when only baseline issues remain, taken from feat: baseline mode + touched-line enforcement #288's JsonReportSummary.baselineDiagnosticCount.
  • Touched-lines footnote when filtering removed diagnostics (consumes feat: baseline mode + touched-line enforcement #288's diagnosticsHiddenByTouchedLines).

action.yml integration

RAW_FILE="${RUNNER_TEMP:-/tmp}/react-doctor-raw-${GITHUB_RUN_ID:-$$}.txt"
set +e
npx react-doctor@latest "$INPUT_DIRECTORY" "${FLAGS[@]}" \
  --pr-comment --pr-comment-output "$MARKDOWN_FILE" | tee "$RAW_FILE"
PIPELINE_EXIT_CODES=("${PIPESTATUS[@]}")
set -e
sed -E '/^::(error|warning) /d' "$RAW_FILE" > "$OUTPUT_FILE"
if [ "${PIPELINE_EXIT_CODES[1]}" -ne 0 ]; then exit "${PIPELINE_EXIT_CODES[1]}"; fi
exit "${PIPELINE_EXIT_CODES[0]}"

The github-script step prefers the markdown file when available; it falls back to the legacy plaintext-in-fence layout when running against older react-doctor versions that don't ship --pr-comment-output.

Stats

  • 6 new tests in build-pr-comment-markdown.
  • Updated github-action contract tests for the single-scan + PIPESTATUS preservation.
  • All 1223 tests passing; lint / typecheck / format clean.

Originally landed as part of #286.

Open in Web Open in Cursor 

@reactreview
Copy link
Copy Markdown

reactreview Bot commented May 17, 2026

🔴 No new issues

0/100 (unchanged)

Reviewed by react-review for commit 18de41d. Configure here.

@vercel
Copy link
Copy Markdown

vercel Bot commented May 17, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
react-doctor-website Ready Ready Preview, Comment May 17, 2026 0:16am

@aidenybai aidenybai marked this pull request as ready for review May 17, 2026 08:37
Comment thread packages/react-doctor/src/cli/utils/build-pr-comment-markdown.ts
Comment thread packages/react-doctor/src/cli/utils/build-pr-comment-markdown.ts Outdated
@cursor cursor Bot force-pushed the cursor/baseline-and-touched-lines-675b branch from d702581 to 53c60c5 Compare May 17, 2026 08:56
@cursor cursor Bot force-pushed the cursor/pr-comment-markdown-675b branch from 71b2e54 to 18bdcc6 Compare May 17, 2026 09:00
Comment thread packages/react-doctor/src/cli/utils/build-pr-comment-markdown.ts Outdated
@cursor cursor Bot force-pushed the cursor/baseline-and-touched-lines-675b branch from 53c60c5 to 4db24e7 Compare May 17, 2026 09:23
@cursor cursor Bot force-pushed the cursor/pr-comment-markdown-675b branch from 18bdcc6 to 7d8b50a Compare May 17, 2026 09:25
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 7d8b50a. Configure here.

Comment thread packages/react-doctor/src/cli/commands/inspect.ts Outdated
@cursor cursor Bot force-pushed the cursor/baseline-and-touched-lines-675b branch from 4db24e7 to a9c3e64 Compare May 17, 2026 09:52
@cursor cursor Bot force-pushed the cursor/pr-comment-markdown-675b branch from 7d8b50a to c8736b1 Compare May 17, 2026 09:53
@cursor cursor Bot force-pushed the cursor/baseline-and-touched-lines-675b branch from a9c3e64 to 62eba8e Compare May 17, 2026 11:00
@cursor cursor Bot force-pushed the cursor/pr-comment-markdown-675b branch from c8736b1 to 56c2ac3 Compare May 17, 2026 11:01
@cursor cursor Bot force-pushed the cursor/baseline-and-touched-lines-675b branch from 62eba8e to dd93a69 Compare May 17, 2026 12:14
Third and final PR of the #286 split. Stacked on
cursor/baseline-and-touched-lines-675b (#288).

- New `--pr-comment-output <path>` CLI flag writes a sticky-PR-comment-
  ready markdown document to a side file. Compose with --pr-comment so
  one scan produces both the build-log plaintext (stdout) and the
  structured markdown (file) without re-invoking the scanner.
- buildPrCommentMarkdown: `<!-- react-doctor -->` marker, per-rule
  `<details>` groups with severity icons + file:line refs +
  suppression snippets, per-package summary block for monorepos
  (worst-scored project drives the headline), baseline-aware framing
  ("no new violations introduced by this PR"), touched-lines
  footnote when filtering removed diagnostics.
- action.yml: single-scan dual-output integration. The github-script
  step now prefers the markdown file when available and falls back
  to the legacy plaintext-in-fence layout when running against older
  react-doctor versions.
- 6 new tests in build-pr-comment-markdown plus updated github-action
  contract tests for the single-scan + PIPESTATUS preservation.

1223 tests passing.

Co-authored-by: Aiden Bai <aidenybai@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants