-
Notifications
You must be signed in to change notification settings - Fork 2
Add PR preview cleanup workflow for frontend #226
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
lmcdonough
wants to merge
9
commits into
main
Choose a base branch
from
225-feature-create-github-actions-workflows-for-preview-environments-on-pull-requests
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Add PR preview cleanup workflow for frontend #226
lmcdonough
wants to merge
9
commits into
main
from
225-feature-create-github-actions-workflows-for-preview-environments-on-pull-requests
Conversation
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
Implement frontend PR preview overlay workflow that calls the reusable deployment workflow from the backend repository. **New File:** - pr-preview-frontend.yml: Frontend PR overlay workflow - Triggers on frontend PR events (opened, synchronize, reopened) - Calls refactor-platform-rs reusable workflow - Builds frontend from PR branch, uses main-arm64 backend - Uses repository-level secrets (no pr-preview environment) - Passes all required secrets for deployment to RPi5 **Workflow Strategy:** - repo_type: 'frontend' - builds frontend from PR, backend from main - Automatic main-arm64 backend build if image doesn't exist - Isolated PR environment with unique ports - Full stack deployment (postgres, backend, frontend) on Neo/RPi5 **Secret Requirements:** All secrets must be configured at repository level in frontend repo: - RPi5 SSH/Tailscale connection details - Database configuration (postgres user, password, db, schema) - Third-party service credentials (TipTap, MailerSend) - Frontend build configuration (backend service connection) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Remove all secret passing from frontend PR preview workflow. Secrets are now automatically accessed from backend repo's pr-preview environment. **Workflow Changes:** - Remove entire `secrets:` section (45+ lines removed) - No secrets needed in frontend repo for PR previews - Workflow now only passes configuration inputs - Uses backend repo's pr-preview environment automatically **Documentation:** - Add comprehensive PR preview runbook - Links to backend runbook for complete details - Add PR preview section to README - Quick reference for developers **Result:** - Frontend repo needs ZERO PR preview secrets - All secrets managed centrally in backend repo - Single source of truth for configuration - Simpler onboarding for new developers 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Add automatic cleanup workflow that triggers when frontend PRs are closed or merged, calling the backend repo's reusable cleanup workflow. **Frontend Caller (cleanup-pr-preview-frontend.yml):** - Triggers on pull_request types: [closed] - Calls backend repo's reusable cleanup workflow - Passes only repo_type, pr_number, branch_name - No secrets needed (uses backend pr-preview environment) **What Gets Cleaned:** - Docker containers (postgres, backend, frontend, migrator) - Docker volumes (database data) - Compose and environment files - PR-specific images from RPi5 and GHCR **What Gets Kept:** - PostgreSQL base images (shared across PRs) - main-arm64 images (for Docker layer caching) **Benefits:** - Automatic cleanup on PR close/merge - Zero secrets required in frontend repo - Prevents resource accumulation - Follows same pattern as deploy workflow 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Add 'secrets: inherit' to pass GITHUB_TOKEN to the reusable workflow in the backend repository. This is required when calling workflows across repository boundaries. The reusable workflow (in refactor-platform-rs) uses its own pr-preview environment for all secrets, but needs the GITHUB_TOKEN from the calling repository for authentication. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
…se specific commit for staging environment
…TODO Changes: 1. Add TODO comment to update workflow reference to @main once backend PR #201 merges 2. Clarify that environment resolution uses backend repo's pr-preview environment 3. Add cleanup workflow to paths-ignore for consistency with backend The frontend workflow now correctly documents that when calling the backend's reusable workflow, the 'environment: pr-preview' references in that workflow resolve to the BACKEND repo's environment, not the frontend's. This allows centralizing all secrets in the backend repo's pr-preview environment. The workflow inherits the fix from backend PR #201 (removal of problematic 'if: needs.build-arm64-image.result == success' condition) and will deploy the full stack (backend + frontend + postgres) to neo when frontend PRs are opened or updated. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This empty commit tests the frontend PR preview workflow to verify: - Secrets are now accessible from backend repo's pr-preview environment - Frontend lint and test jobs succeed - Full stack deploys to neo (postgres + backend + frontend) - PR comment posts with access URLs 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Before merge: The docker-compose.pr-preview.yaml file only exists on the backend PR branch (190-add-a-staging-environment...), not on main yet. To allow frontend PR testing now, temporarily use the backend PR branch. After merge: Both the workflow reference (@main) and backend_branch ('main') should be updated back to stable references. Changes: - backend_branch: Use backend PR branch temporarily (has compose file) - Updated TODO comments to be more specific about post-merge changes This allows frontend workflow to succeed both before and after backend PR #201 merges, following the same paradigm as backend workflow. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
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.
Implements automated cleanup for PR preview environments. Triggers on pull_request closed event and calls backend reusable workflow.