Skip to content

Surface Vercel PR previews reliably (Deployment + stamped comment) - #171

Merged
brunogbv merged 1 commit into
mainfrom
fix/pr-preview-surfacing
Jul 4, 2026
Merged

brunogbv merged 1 commit into
mainfrom
fix/pr-preview-surfacing

Conversation

@brunogbv

@brunogbv brunogbv commented Jul 4, 2026

Copy link
Copy Markdown
Owner

Problem

Preview URLs were surfaced as a single PR comment edited in place. GitHub doesn't notify on edits
and the comment stays pinned at its original timeline position, so after the first deploy it looked
stale — on #156 the real per-commit URLs (cv-dp2pt2exx…, cv-1ght27m3n…, cv-bzvlalugy…) were only
visible in the Deploy logs. All runs succeeded; the issue was purely surfacing.

Change (.github/workflows/deploy.yml)

  • Native surface: publish a GitHub Deployment + status per push (environment
    preview-pr-<n>, transient + auto_inactive), so the preview shows in the PR's Deployments
    box and on the head commit and refreshes every push. Non-fatal (try/catch) so a deployment hiccup
    can't fail the deploy or block the comment.
  • Comment surface: keep the single upserted comment but stamp it with the short SHA + UTC time
    so an in-place edit is unmistakably current; per_page: 100 on the lookup.
  • Harden capture: extract the *.vercel.app URL by pattern (not tail -1); fail the step on
    make deploy's real exit code or an empty URL, so a broken capture can't post an empty link
    (same spirit as make lint: surface Super-Linter's real exit code (wrapper masks failures) #169).
  • Adds the deployments: write permission.
  • docs/ci-cd.md updated to describe both surfaces.

Verification

  • make lint-actions (actionlint 1.7.1), full make lint (Super-Linter — YAML + Markdown + all
    validators "linted successfully", real exit 0), and make lint-fast all pass.
  • Independent adversarial review: no blockers / should-fix. Confirmed the if: implies
    success() (failed deploy skips surfacing), the shell capture fails correctly on the no-secrets
    path, the Deployments API params are valid (required_contexts: [] + auto_merge: false → 201),
    auto_inactive is scoped per-PR, and nothing weakens the required "Build and deploy" check.
  • This PR live-tests itself: its own Deploy run should post a Deployment + a SHA/time-stamped
    preview comment below.

Closes #170

🤖 Generated with Claude Code

The preview URL was posted as a single PR comment edited in place — GitHub
doesn't notify on edits and it stays pinned in the timeline, so after the
first deploy it looked stale and the real per-commit URLs were only in the CI
logs.

deploy.yml now:
- publishes a GitHub Deployment + status per push (environment preview-pr-<n>),
  so the preview shows in the PR's Deployments box and on the head commit,
  refreshed each push;
- stamps the single upserted comment with the short SHA + UTC time so an
  in-place edit is unmistakably current;
- extracts the *.vercel.app URL by pattern (not `tail -1`) and fails the step
  on make deploy's real exit code or an empty URL, so a broken capture can't
  post an empty/stale link;
- adds the deployments: write permission.

docs/ci-cd.md updated to describe the two surfaces.

Closes #170

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@github-actions

github-actions Bot commented Jul 4, 2026

Copy link
Copy Markdown

🔺 Vercel preview: https://cv-jq6xb10ci-bruno-valerios-projects.vercel.app

commit a9a517f · updated 2026-07-04 14:48 UTC

@brunogbv
brunogbv merged commit c35bf5d into main Jul 4, 2026
13 checks passed
@brunogbv
brunogbv deleted the fix/pr-preview-surfacing branch July 4, 2026 14:50

This branch was successfully deployed

1 active deployment
preview-pr-171 — a9a517fb Deployed Jul 4, 2026 by github-actions[bot]
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.

Vercel preview URL not reliably surfaced on PRs (single in-place comment; per-commit URLs only in CI logs)

1 participant