feat: preview mode CI integration via GitHub Action#1041
Conversation
Port the local `pnpm preview` logic to CI so every PR gets an automatic preview link comment. Harden preview.ts to throw on missing env vars, write to $GITHUB_OUTPUT, and skip watchers in CI. Remove the link-check job (incompatible with cookie-based draft mode previews). Co-Authored-By: Claude <noreply@anthropic.com>
The CI checkout only has the remote ref, not a local main branch. Co-Authored-By: Claude <noreply@anthropic.com>
- Move env var check before indexer run (fail fast) - Refactor generate-preview into reusable composite action - Remove fern-check job (no longer needed) - Comment out link-check with TODO (draft mode incompatible with lychee) - Update PR comment branding to "Preview Mode" Co-Authored-By: Claude <noreply@anthropic.com>
🔗 Preview Mode
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 42611d3262
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
Pull request overview
This PR updates the PR-checks GitHub Actions workflow to generate documentation previews using the repository’s content indexer preview mode, and posts/updates a PR comment with the resulting preview link.
Changes:
- Update preview indexing script behavior for CI (required env vars, emit preview URL to
$GITHUB_OUTPUT, skip watchers in CI). - Rework the
generate-previewcomposite action to runnpx tsx src/content-indexer/preview.tsand post “building”/result comments. - Adjust preview MDX uploader to diff against
origin/main, and remove/disable link-checking tied to preview crawling.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
src/content-indexer/uploaders/preview-mdx.ts |
Switch diff base to origin/main for changed-file detection. |
src/content-indexer/preview.ts |
Require preview env vars, emit preview URL to $GITHUB_OUTPUT, and exit early in CI. |
scripts/preview-comment.js |
Update the PR comment title used for preview status/link comments. |
.github/workflows/pr-checks.yml |
Simplify preview generation job and disable link-check job. |
.github/actions/generate-preview/action.yml |
Replace Fern-based preview generation with content-indexer execution + PR comment posting. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Rename output key from preview-url to preview_url (hyphens parsed as subtraction in GHA expressions) - Pass github-token via with: instead of env: for actions/github-script - Use hidden HTML marker for stable comment matching across title changes Co-Authored-By: Claude <noreply@anthropic.com>
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: eca64c7906
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
Summary
generate-previewcomposite action to run the content indexer instead of Fernpreview.tsdefault mode: throw on missing env vars, write preview URL to$GITHUB_OUTPUT, skip watchers whenCIis setfern-checkjob (no longer needed)link-checkjob (lychee can't crawl cookie-based draft mode previews)Closes DX-2301
Test plan
pnpm previewlocally — still indexes, uploads, prints URL, and starts watchers