Skip to content

Feature: Per-PR preview environments on Fly.io - #169

Closed
khaliqgant wants to merge 1 commit into
mainfrom
feature/pr-preview-environments
Closed

khaliqgant wants to merge 1 commit into
mainfrom
feature/pr-preview-environments

Conversation

@khaliqgant

Copy link
Copy Markdown
Member

Implement automatic preview environments for each pull request.

What's included

  • .github/workflows/preview.yml - Deploy PR previews to Fly.io
  • .github/workflows/preview-cleanup.yml - Clean up environments on PR close

How it works

  • Each PR gets isolated Fly.io app: relay-pr-{number}
  • Shared staging database and Redis
  • PR comment with live environment URL
  • Automatic cleanup when PR closes

Before merging

Configure these GitHub secrets in repo settings:

  • PREVIEW_SESSION_SECRET
  • PREVIEW_DATABASE_URL
  • PREVIEW_REDIS_URL
  • PREVIEW_GITHUB_CLIENT_ID
  • PREVIEW_GITHUB_CLIENT_SECRET
  • PREVIEW_VAULT_ENCRYPTION_KEY
  • PREVIEW_NANGO_SECRET_KEY

Once configured, workflows will:

  1. Trigger automatically on new PRs
  2. Deploy to Fly.io
  3. Comment PR with live environment URL
  4. Auto-cleanup on PR close

- Add preview.yml workflow for deploying PR previews
- Add preview-cleanup.yml for destroying previews on PR close
- Each PR gets isolated Fly.io app named relay-pr-{number}
- Posts deployment URL as PR comment with status updates
- Uses shared staging database (PREVIEW_* secrets)
- Health check verification before marking deployment complete
- Auto-cleanup when PR is closed/merged

Required secrets:
- PREVIEW_SESSION_SECRET
- PREVIEW_DATABASE_URL
- PREVIEW_REDIS_URL
- PREVIEW_GITHUB_CLIENT_ID
- PREVIEW_GITHUB_CLIENT_SECRET
- PREVIEW_VAULT_ENCRYPTION_KEY
- PREVIEW_NANGO_SECRET_KEY

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Jan 13, 2026 •

Copy link
Copy Markdown
Contributor

Preview Environment

Status Destroyed
Reason PR closed

The preview environment has been cleaned up.

@my-senior-dev-pr-review

Copy link
Copy Markdown

🤖 My Senior Dev — Analysis Complete

👤 For @khaliqgant

📁 Expert in src/dashboard/react-components/ (7 edits) • ⚡ 27th PR this month

View your contributor analytics →


📊 2 files reviewed • 4 need attention

⚠️ Needs Attention:

  • .github/workflows/preview-cleanup.yml — Concerns around secret management and error handling in the cleanup logic.

🚀 Open Interactive Review →

The full interface unlocks features not available in GitHub:

  • 💬 AI Chat — Ask questions on any file, get context-aware answers
  • 🔍 Smart Hovers — See symbol definitions and usage without leaving the diff
  • 📚 Code Archeology — Understand how files evolved over time (/archeology)
  • 🎯 Learning Insights — See how this PR compares to similar changes

💬 Chat here: @my-senior-dev explain this change — or try @chaos-monkey @security-auditor @optimizer @skeptic @junior-dev

📖 View all 12 personas & slash commands

You can interact with me by mentioning @my-senior-dev in any comment:

In PR comments or on any line of code:

  • Ask questions about the code or PR
  • Request explanations of specific changes
  • Get suggestions for improvements

Slash commands:

  • /help — Show all available commands
  • /archeology — See the history and evolution of changed files
  • /profile — Performance analysis and suggestions
  • /expertise — Find who knows this code best
  • /personas — List all available AI personas

AI Personas (mention to get their perspective):

Persona Focus
@chaos-monkey 🐵 Edge cases & failure scenarios
@skeptic 🤨 Challenge assumptions
@optimizer ⚡ Performance & efficiency
@security-auditor 🔒 Security vulnerabilities
@accessibility-advocate ♿ Inclusive design
@junior-dev 🌱 Simple explanations
@tech-debt-collector 💳 Code quality & shortcuts
@ux-champion 🎨 User experience
@devops-engineer 🚀 Deployment & scaling
@documentation-nazi 📚 Documentation gaps
@legacy-whisperer 🏛️ Working with existing code
@test-driven-purist ✅ Testing & TDD

For the best experience, view this PR on myseniordev.com — includes AI chat, file annotations, and interactive reviews.

@khaliqgant khaliqgant closed this Feb 9, 2026
@khaliqgant
khaliqgant deleted the feature/pr-preview-environments branch February 9, 2026 20:27
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.

1 participant