Skip to content

feat(comment): redesign deployment comments with rich HTML table#320

Merged
amondnet merged 8 commits intomasterfrom
amondnet/roomy-attempt
Mar 29, 2026
Merged

feat(comment): redesign deployment comments with rich HTML table#320
amondnet merged 8 commits intomasterfrom
amondnet/roomy-attempt

Conversation

@amondnet
Copy link
Copy Markdown
Owner

@amondnet amondnet commented Mar 29, 2026

Summary

  • Replace plain-text deployment comments with structured HTML table format (similar to Cloudflare Pages / Vercel's native bot)
  • Add inspect URL support via InspectResult return type from Vercel inspect
  • Maintain backward compatibility for custom string templates

Changes

  • src/types.ts — New InspectResult interface
  • src/utils.ts — New buildHtmlTableComment(), updated buildCommentBody()
  • src/github-comments.ts — Pass inspectUrl through comment functions
  • src/index.ts — Wire inspect URL from deployment flow
  • src/vercel-cli.ts / src/vercel-api.ts — Return InspectResult from inspect

Test plan

  • Unit tests pass (pnpm test)
  • HTML table renders correctly in GitHub comment markdown
  • Custom template backward compatibility verified
  • Alias domains show as additional rows
  • Inspect URL appears when available

Closes #319


Summary by cubic

Redesigned GitHub deployment comments to a rich HTML table that shows project, status, preview URL, commit, aliases, and an Inspect link. Keeps custom templates working and adds safer, more robust inspect handling. Closes #319.

  • New Features

    • Default comment (github-comment: true) now renders a structured HTML table.
    • Added Inspect URL support via InspectResult; included in comments when available.
    • Preserves custom string templates (no behavior changes for users with custom bodies).
  • Bug Fixes

    • Escape HTML in comment content to prevent injection.
    • Guard vercelInspect when deploymentUrl is empty.
    • Trim and parse CLI/API inspect output reliably; return both name and inspectUrl.

Written for commit dafd38c. Summary will update on new commits.

Add track for improving GitHub deployment comments with rich HTML
table format. Includes spec, plan with 8 tasks, and linked issue #319.
Replace plain-text deployment comments with a structured HTML table
format showing project name, status, preview URL, commit SHA, alias
domains, and inspect URL. Custom string templates remain supported
for backward compatibility.

Closes #319
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 29, 2026

Deploy preview for team-scope-test ready!

✅ Preview
https://team-scope-test-izyqhpnbj-dietfriends.vercel.app

Built with commit dafd38c.
This pull request is being automatically deployed with vercel-action

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 29, 2026

Deploy preview for express-basic-auth ready!

✅ Preview
https://express-basic-auth-5sydxs34t-minsu-lees-projects-b1e388b7.vercel.app

Built with commit dafd38c.
This pull request is being automatically deployed with vercel-action

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 29, 2026

Deploy preview for zeit-now-deployment-action-example-angular ready!

✅ Preview
https://zeit-now-deployment-action-example-angular-o7u16fgio.vercel.app
https://staging.angular.vercel-action.amond.dev
https://pr-320.angular.vercel-action.amond.dev

Built with commit dafd38c.
This pull request is being automatically deployed with vercel-action

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request replaces the plain-text GitHub deployment comments with a structured HTML table format, including project name, status, preview URL, commit SHA, and optional alias and inspection links. The feedback highlights a logic error where the inspection link is skipped if a project name is manually configured, and identifies a need for HTML escaping of dynamic values to prevent layout breakage or potential injection vulnerabilities.

- Add escapeHtml() to prevent XSS in HTML table comments
- Always run vercelInspect to get inspectUrl even when project name is set
- Trim parsed CLI output to handle trailing whitespace/CRLF
@amondnet amondnet marked this pull request as ready for review March 29, 2026 08:51
Copilot AI review requested due to automatic review settings March 29, 2026 08:51
Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

No issues found across 15 files

Requires human review: Significant redesign of deployment comments and internal data structures across 15 files. Requires human review of the new HTML rendering and CLI parsing logic.

Architecture diagram
sequenceDiagram
    participant Index as Action Entry (index.ts)
    participant Vercel as Vercel Client (CLI/API)
    participant GHC as GitHub Comments
    participant Utils as Utils (Comment Builder)
    participant GH as GitHub API (Octokit)

    Note over Index,Vercel: Deployment Phase
    Index->>Vercel: vercelDeploy()
    Vercel-->>Index: deploymentUrl

    Note over Index,Vercel: CHANGED: Metadata Extraction
    Index->>Vercel: CHANGED: inspect(deploymentUrl)
    Vercel->>Vercel: Parse name and inspectorUrl
    Vercel-->>Index: NEW: InspectResult { name, inspectUrl }

    Note over Index,GH: Commenting Phase
    Index->>GHC: handleComments(..., inspectUrl)
    
    GHC->>Utils: buildCommentBody(..., inspectUrl)
    
    alt github-comment input is 'true'
        Utils->>Utils: NEW: buildHtmlTableComment()
        Note right of Utils: Generates HTML <table> with<br/>status, preview, and inspect links
    else github-comment is custom string
        Utils->>Utils: Process custom template variables
    end
    
    Utils-->>GHC: commentBody (HTML or Plaintext)

    GHC->>GH: findPreviousComment()
    GH-->>GHC: commentId (if exists)

    alt Comment exists
        GHC->>GH: updateComment(commentId, commentBody)
    else No comment exists
        GHC->>GH: createComment(commentBody)
    end

    GH-->>GHC: Success
    GHC-->>Index: Done
Loading

The defaultTemplate parameter is no longer used in buildCommentBody()
since HTML table is now the default format. Prefix with underscore to
satisfy TypeScript strict unused variable checks during ncc compilation.
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR redesigns the default GitHub deployment comment to render as a rich HTML <table> (Cloudflare/Vercel-bot style) and threads an optional Vercel “inspect” URL through the deployment/comment pipeline while keeping custom string templates working.

Changes:

  • Add InspectResult and update Vercel inspect implementations (CLI/API) to return { name, inspectUrl }.
  • Generate HTML table comments (with HTML escaping, alias rows, and optional inspect link) when github-comment: true.
  • Wire inspectUrl through index.tsgithub-comments.tsbuildCommentBody(), and update tests/docs accordingly.

Reviewed changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/types.ts Introduces InspectResult and updates VercelClient.inspect() return type.
src/vercel.ts Updates vercelInspect() to return InspectResult.
src/vercel-cli.ts Parses name + inspectorUrl from vercel inspect output into InspectResult.
src/vercel-api.ts Returns { name, inspectUrl } from /v13/deployments/:id.
src/utils.ts Adds escapeHtml() + buildHtmlTableComment() and switches default comment rendering to HTML table.
src/index.ts Plumbs inspectUrl through outputs/comments; always runs inspect currently.
src/github-comments.ts Passes inspectUrl into buildCommentBody() for commit/PR comments.
src/tests/vercel.test.ts Updates inspect unit tests for the new return shape + inspector URL parsing.
src/tests/utils.test.ts Adds coverage for HTML escaping/table output and updated comment body behavior.
src/tests/github-comments.test.ts Updates expectations for table-based comment rendering.
src/integration/vercel-api.test.ts Updates integration assertions to use result.name.
.please/docs/tracks/index.md Adds the new track entry.
.please/docs/tracks/active/improve-github-comment-20260329/* Adds spec/plan/metadata for the feature track.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@amondnet amondnet self-assigned this Mar 29, 2026
Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

0 issues found across 1 file (changes from recent commits).

Requires human review: This PR modifies core deployment logic and internal interfaces to redesign GitHub comments using HTML tables. These structural changes and the introduction of new HTML-based formatting warrant human审.

Guard vercelInspect call when deploymentUrl is empty to avoid
unnecessary CLI/API calls with invalid input.
@sonarqubecloud
Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
1 Security Hotspot

See analysis details on SonarQube Cloud

Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

0 issues found across 3 files (changes from recent commits).

Requires human review: Significant refactor of comment logic, changes internal interface signatures, and modifies the main execution flow for deployment reporting.

@amondnet amondnet merged commit 255bd7b into master Mar 29, 2026
13 of 15 checks passed
@amondnet amondnet deleted the amondnet/roomy-attempt branch March 29, 2026 09:01
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.

feat: improve GitHub deployment comments with rich HTML table format

2 participants