Skip to content

ci: add back upsert-pr-comment#6948

Merged
lachlancollins merged 1 commit intomainfrom
benchmark-upsert
Mar 17, 2026
Merged

ci: add back upsert-pr-comment#6948
lachlancollins merged 1 commit intomainfrom
benchmark-upsert

Conversation

@lachlancollins
Copy link
Member

@lachlancollins lachlancollins commented Mar 17, 2026

See #6944 (comment)

Summary by CodeRabbit

  • Chores
    • Added automation to manage bundle-size metrics in pull request comments via GitHub API, enhancing visibility of build performance during code review

@changeset-bot
Copy link

changeset-bot bot commented Mar 17, 2026

⚠️ No Changeset found

Latest commit: 1035626

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 17, 2026

📝 Walkthrough

Walkthrough

A new Node.js script is introduced to manage GitHub PR comments for bundle-size reports. It parses CLI arguments, reads comment body content, lists existing PR comments via the GitHub API, and either updates an existing comment or creates a new one using unique marker identification.

Changes

Cohort / File(s) Summary
PR Comment Management Script
scripts/benchmarks/common/upsert-pr-comment.mjs
New script for upserting bundle-size comments on GitHub PRs. Handles CLI argument validation, file reading, paginated API calls to list comments, and conditional PATCH/POST operations to update or create comments. Includes error handling and environment variable fallbacks for repository, token, and API endpoint configuration.

Sequence Diagram

sequenceDiagram
    participant Script as PR Comment Script
    participant API as GitHub API
    participant PR as GitHub PR
    
    Script->>Script: Parse and validate CLI arguments
    Script->>Script: Read body file and ensure marker
    
    Script->>API: List existing PR comments (paginated)
    API-->>Script: Return comment list
    
    alt Comment with marker exists
        Script->>API: PATCH update existing comment
        API-->>PR: Update comment
    else No matching comment found
        Script->>API: POST create new comment
        API-->>PR: Create comment
    end
    
    API-->>Script: Success response
    Script->>Script: Write success message to stdout
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 A script hops into place,
GitHub comments it will embrace,
Bundle sizes up we go,
With markers bright in PR's glow,
Updates dance, new comments grow! 📊✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly indicates the primary change: reintroducing a script for upserting PR comments in CI, matching the actual file addition.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch benchmark-upsert
📝 Coding Plan
  • Generate coding plan for human review comments

Comment @coderabbitai help to get the list of available commands and usage tips.

@nx-cloud
Copy link

nx-cloud bot commented Mar 17, 2026

View your CI Pipeline Execution ↗ for commit 1035626

Command Status Duration Result
nx affected --targets=test:eslint,test:unit,tes... ✅ Succeeded <1s View ↗
nx run-many --target=build --exclude=examples/*... ✅ Succeeded 3s View ↗

☁️ Nx Cloud last updated this comment at 2026-03-17 11:15:41 UTC

@github-actions
Copy link
Contributor

🚀 Changeset Version Preview

No changeset entries found. Merging this PR will not cause a version bump for any packages.

@pkg-pr-new
Copy link

pkg-pr-new bot commented Mar 17, 2026

More templates

@tanstack/arktype-adapter

npm i https://pkg.pr.new/@tanstack/arktype-adapter@6948

@tanstack/eslint-plugin-router

npm i https://pkg.pr.new/@tanstack/eslint-plugin-router@6948

@tanstack/history

npm i https://pkg.pr.new/@tanstack/history@6948

@tanstack/nitro-v2-vite-plugin

npm i https://pkg.pr.new/@tanstack/nitro-v2-vite-plugin@6948

@tanstack/react-router

npm i https://pkg.pr.new/@tanstack/react-router@6948

@tanstack/react-router-devtools

npm i https://pkg.pr.new/@tanstack/react-router-devtools@6948

@tanstack/react-router-ssr-query

npm i https://pkg.pr.new/@tanstack/react-router-ssr-query@6948

@tanstack/react-start

npm i https://pkg.pr.new/@tanstack/react-start@6948

@tanstack/react-start-client

npm i https://pkg.pr.new/@tanstack/react-start-client@6948

@tanstack/react-start-server

npm i https://pkg.pr.new/@tanstack/react-start-server@6948

@tanstack/router-cli

npm i https://pkg.pr.new/@tanstack/router-cli@6948

@tanstack/router-core

npm i https://pkg.pr.new/@tanstack/router-core@6948

@tanstack/router-devtools

npm i https://pkg.pr.new/@tanstack/router-devtools@6948

@tanstack/router-devtools-core

npm i https://pkg.pr.new/@tanstack/router-devtools-core@6948

@tanstack/router-generator

npm i https://pkg.pr.new/@tanstack/router-generator@6948

@tanstack/router-plugin

npm i https://pkg.pr.new/@tanstack/router-plugin@6948

@tanstack/router-ssr-query-core

npm i https://pkg.pr.new/@tanstack/router-ssr-query-core@6948

@tanstack/router-utils

npm i https://pkg.pr.new/@tanstack/router-utils@6948

@tanstack/router-vite-plugin

npm i https://pkg.pr.new/@tanstack/router-vite-plugin@6948

@tanstack/solid-router

npm i https://pkg.pr.new/@tanstack/solid-router@6948

@tanstack/solid-router-devtools

npm i https://pkg.pr.new/@tanstack/solid-router-devtools@6948

@tanstack/solid-router-ssr-query

npm i https://pkg.pr.new/@tanstack/solid-router-ssr-query@6948

@tanstack/solid-start

npm i https://pkg.pr.new/@tanstack/solid-start@6948

@tanstack/solid-start-client

npm i https://pkg.pr.new/@tanstack/solid-start-client@6948

@tanstack/solid-start-server

npm i https://pkg.pr.new/@tanstack/solid-start-server@6948

@tanstack/start-client-core

npm i https://pkg.pr.new/@tanstack/start-client-core@6948

@tanstack/start-fn-stubs

npm i https://pkg.pr.new/@tanstack/start-fn-stubs@6948

@tanstack/start-plugin-core

npm i https://pkg.pr.new/@tanstack/start-plugin-core@6948

@tanstack/start-server-core

npm i https://pkg.pr.new/@tanstack/start-server-core@6948

@tanstack/start-static-server-functions

npm i https://pkg.pr.new/@tanstack/start-static-server-functions@6948

@tanstack/start-storage-context

npm i https://pkg.pr.new/@tanstack/start-storage-context@6948

@tanstack/valibot-adapter

npm i https://pkg.pr.new/@tanstack/valibot-adapter@6948

@tanstack/virtual-file-routes

npm i https://pkg.pr.new/@tanstack/virtual-file-routes@6948

@tanstack/vue-router

npm i https://pkg.pr.new/@tanstack/vue-router@6948

@tanstack/vue-router-devtools

npm i https://pkg.pr.new/@tanstack/vue-router-devtools@6948

@tanstack/vue-router-ssr-query

npm i https://pkg.pr.new/@tanstack/vue-router-ssr-query@6948

@tanstack/vue-start

npm i https://pkg.pr.new/@tanstack/vue-start@6948

@tanstack/vue-start-client

npm i https://pkg.pr.new/@tanstack/vue-start-client@6948

@tanstack/vue-start-server

npm i https://pkg.pr.new/@tanstack/vue-start-server@6948

@tanstack/zod-adapter

npm i https://pkg.pr.new/@tanstack/zod-adapter@6948

commit: 1035626

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
scripts/benchmarks/common/upsert-pr-comment.mjs (1)

7-7: Extract DEFAULT_MARKER to a shared module.

This literal is already duplicated in scripts/benchmarks/bundle-size/pr-report.mjs line 7. If the two values ever drift, the report generator and the upsert step will stop agreeing on the lookup key, and CI will start creating duplicate comments instead of updating the existing one.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@scripts/benchmarks/common/upsert-pr-comment.mjs` at line 7, Extract the
duplicated constant DEFAULT_MARKER into a single shared module (e.g., export a
constant from a new shared file) and replace the local literal in
upsert-pr-comment.mjs and the duplicated literal in bundle-size/pr-report.mjs to
import that shared DEFAULT_MARKER; update both files to import the symbol
(DEFAULT_MARKER) from the shared module so both the upsert step and report
generator use the same canonical value and avoid drift/duplicate comments.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@scripts/benchmarks/common/upsert-pr-comment.mjs`:
- Line 7: Extract the duplicated constant DEFAULT_MARKER into a single shared
module (e.g., export a constant from a new shared file) and replace the local
literal in upsert-pr-comment.mjs and the duplicated literal in
bundle-size/pr-report.mjs to import that shared DEFAULT_MARKER; update both
files to import the symbol (DEFAULT_MARKER) from the shared module so both the
upsert step and report generator use the same canonical value and avoid
drift/duplicate comments.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 1e371f02-9feb-4c1f-8d5d-23c042682521

📥 Commits

Reviewing files that changed from the base of the PR and between 13ef4c2 and 1035626.

📒 Files selected for processing (1)
  • scripts/benchmarks/common/upsert-pr-comment.mjs

@lachlancollins lachlancollins merged commit 97dc9f6 into main Mar 17, 2026
7 checks passed
@lachlancollins lachlancollins deleted the benchmark-upsert branch March 17, 2026 11:40
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.

1 participant