feat(ci): add isolated PR preview environments#24
Merged
Conversation
Add GitHub Actions workflow for PR preview deployments with isolated infrastructure: - Preview API Worker (append-api-preview) with separate D1 database and R2 bucket - Preview web deployment that connects to preview API instead of production - Google OAuth configured for preview environments - Automatic PR comments with deployment URLs Infrastructure: - Created preview D1 database (append-db-preview) - Created preview R2 bucket (append-imports-preview) - Configured preview environment in wrangler.jsonc with stub AI provider - Set up Google OAuth secrets for preview worker Web configuration: - Add VITE_API_URL environment variable support for dynamic API URLs - Preview builds now point to preview API - Production builds explicitly set production API URL - Add TypeScript definitions for VITE_API_URL Workflows: - New .github/workflows/preview.yml for PR preview deployments - Updated .github/workflows/deploy.yml to explicitly set production API URL - Both workflows post deployment URLs as PR comments Documentation: - Updated docs/runbook.md with preview environment setup and usage - Documented preview secrets configuration - Added manual preview deployment commands 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
append-api | 0778fcb | Commit Preview URL Branch Preview URL |
Jan 02 2026, 05:18 PM |
Deploying append-web with
|
| Latest commit: |
0778fcb
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://50d732a6.append-web.pages.dev |
| Branch Preview URL: | https://feat-pr-preview-environments.append-web.pages.dev |
🚀 Preview DeploymentsAPI: https://append-api-preview.tindotdev.workers.dev |
When wrangler deploy fails, the error output is captured but never printed due to bash's `set -e` flag causing immediate exit. This makes debugging deployment failures impossible. Changes: - Use `set +e` before capturing wrangler output - Store exit code in variable - Always print deployment output - Exit with proper code if deployment failed This ensures error messages are visible in GitHub Actions logs, making it easier to diagnose issues like missing secrets or configuration problems. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add automated PR preview deployments with fully isolated infrastructure to safely test changes before merging to production.
Changes
Infrastructure Setup
append-db-previewappend-imports-previewappend-api-previewGitHub Actions
.github/workflows/preview.yml- PR preview deployments.github/workflows/deploy.yml- Explicit production API URLWeb Configuration
packages/web/src/lib/api-rpc.tsVITE_API_URLenv var definitionsAPI Configuration
packages/api/wrangler.jsoncDocumentation
docs/runbook.mdHow It Works
When a PR is opened:
Preview URLs
https://append-api-preview.tindejphachon.workers.devhttps://<branch>.append-web.pages.devTest Plan
🤖 Generated with Claude Code