Skip to content

ci: post Cloudflare Pages preview URL as PR comment#15

Merged
TeoSlayer merged 1 commit into
mainfrom
ci/preview-url-pr-comment
May 29, 2026
Merged

ci: post Cloudflare Pages preview URL as PR comment#15
TeoSlayer merged 1 commit into
mainfrom
ci/preview-url-pr-comment

Conversation

@TeoSlayer
Copy link
Copy Markdown
Contributor

Summary

Changes

  1. permissions: block gains pull-requests: write so the new step can comment.
  2. Wrangler-action step gets id: deploy so the next step can reference its output.
  3. New Comment preview URL on PR step, gated on pull_request + a non-empty deployment-url (so it skips on push-to-main and on fork PRs where the deploy was skipped).

Test plan

  • Merge → on the next PR, expect a comment of the form 🚀 Preview deployed to Cloudflare Pages… with the commit-keyed deploy URL and the branch alias.
  • Push a second commit to the same PR → the existing comment updates in place (sticky header is cloudflare-pages-preview).
  • Fork-PR: the deploy step is skipped → the comment step is also skipped (no PII leak via PR comments).

Evidence the preview is already being generated

Deploy step log from PR #14's run 26650201315:
```
✨ Deployment complete! https://2b5c12ec.pilotprotocol.pages.dev
✨ Deployment alias URL: https://hank-pilot-26-og-images.pilotprotocol.pages.dev
```

PR #4 added the deploy step but the wrangler-action does not auto-post a
PR comment, so reviewers can't see the preview URL without digging into
workflow logs (verified on PRs #12-14: deploy succeeded, comment missing).

This adds a sticky comment step that uses the deployment-url output from
the wrangler-action and posts (or updates) a single comment per PR via
marocchino/sticky-pull-request-comment@v2.

Also bumps the workflow's permissions to include pull-requests: write,
which is required for the comment step.
@github-actions
Copy link
Copy Markdown

🚀 Preview deployed to Cloudflare Pages

  • Commit deploy URL: https://6597869f.pilotprotocol.pages.dev
  • Branch alias: https://ci/preview-url-pr-comment.pilotprotocol.pages.dev (may take ~30s to propagate)
  • Commit: 20db21237b4d790dd7e3637384bea1e1da6312c3

@TeoSlayer TeoSlayer merged commit 80a142e into main May 29, 2026
2 checks passed
@TeoSlayer TeoSlayer deleted the ci/preview-url-pr-comment branch May 29, 2026 17:13
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