Skip to content

feat(ci): make preview deployment conditional on CI test#8

Open
Aswinmcw wants to merge 14 commits into
mainfrom
optimize/conditional-preview-deployment
Open

feat(ci): make preview deployment conditional on CI test#8
Aswinmcw wants to merge 14 commits into
mainfrom
optimize/conditional-preview-deployment

Conversation

@Aswinmcw

Copy link
Copy Markdown
Member
  • Change trigger from PR events to workflow_run after CI completion
  • Remove redundant test execution in preview workflow
  • Add proper PR information extraction for workflow_run events
  • Update all references to use dynamic PR info
  • Maintain cleanup functionality for PR closure
  • Improve deployment messaging to indicate CI success prerequisite

- Change trigger from PR events to workflow_run after CI completion
- Remove redundant test execution in preview workflow
- Add proper PR information extraction for workflow_run events
- Update all references to use dynamic PR info
- Maintain cleanup functionality for PR closure
- Improve deployment messaging to indicate CI success prerequisite
@Aswinmcw
Aswinmcw requested a review from Aswin-coder as a code owner June 28, 2025 14:15
Aswinmcw added 2 commits June 28, 2025 19:49
The branches filter in workflow_run prevents triggering for PR branches.
workflow_run should trigger for any completed CI workflow regardless of branch.
- Replace workflow_run with pull_request trigger
- Add CI status polling to wait for completion before deployment
- Check for 'all-checks-complete' job success status
- Timeout after 30 minutes if CI doesn't complete
- More reliable than workflow_run trigger limitations
@github-actions

Copy link
Copy Markdown

🚀 Preview Deployment Ready!

CI Tests Passed - Your PR has been successfully deployed after passing all integration tests!

🌐 Preview Link

Frontend + API: https://pr-review-checker-ip2zj5510-aswincoders-projects.vercel.app

📊 Deployment Details

🧪 Test Your Changes

You can now test the PR approval finder with your changes:

  1. Visit the preview URL above
  2. Enter a GitHub PR URL to test functionality
  3. Verify all features work as expected
  4. API endpoints are available at https://pr-review-checker-ip2zj5510-aswincoders-projects.vercel.app/api/*

📝 Notes

  • Tests Passed: All CI tests passed before deployment
  • 🔄 Auto-Updates: Preview updates automatically on new commits (after CI passes)
  • 🧹 Auto-Cleanup: Deployment cleaned up when PR is closed
  • 🚀 Full-Stack: Both frontend and backend API are deployed

Deployed by GitHub Actions after CI success • View Workflow

Aswinmcw added 11 commits June 28, 2025 20:03
- Replace polling with check_suite completion event
- Trigger preview deployment instantly when all checks pass
- No waiting or timeouts - pure event-driven approach
- More efficient and responsive than polling
- Clean separation of CI completion and deployment triggers
- Use workflow_run event with explicit success check
- Improve PR detection using GitHub search API with commit SHA
- Add better logging for debugging trigger issues
- Simplify condition logic for more reliable triggering
- Replace problematic workflow_run with repository_dispatch event
- Add trigger step to CI workflow when all checks pass
- Pass PR information via client payload
- More reliable than workflow_run with better debugging
- Ensures preview only deploys after successful CI completion
- Fix permissions issue with repository_dispatch
- Use workflow_dispatch with manual inputs instead
- Trigger preview workflow using GitHub CLI
- More reliable and doesn't require special permissions
- Maintains the same CI-triggered behavior
- Add checkout step to all-checks-complete job for PR events
- Required for gh CLI to work in git repository context
- Fixes 'fatal: not a git repository' error
- Replace workflow_dispatch trigger with status event
- CI creates 'ci/preview-ready' status on success
- Preview workflow triggers on this specific status
- Avoids permissions issues with workflow dispatch
- More reliable event-driven approach
- Add pull_request trigger as backup to status events
- Enhanced status API logging for debugging
- Check CI status in pull_request events with 60s delay
- Multiple trigger paths for better reliability
- Fallback mechanism if status events don't work
- Remove delay-based CI status checking
- Use workflow_run event for instant triggering when CI completes
- Simplify preview workflow logic without polling or delays
- Only trigger preview deployment after CI pipeline succeeds
- Maintain cleanup functionality for closed PRs
- Add workflow_run trigger with branch filtering for instant deployment
- Keep pull_request trigger as fallback with intelligent CI status checking
- Add comprehensive debugging and trigger source tracking
- Remove artificial delays - use real-time CI status API instead
- Support multiple trigger paths for maximum reliability:
  * workflow_run: instant trigger when CI completes (preferred)
  * pull_request: fallback with CI verification for reliability
  * workflow_dispatch: manual triggering still available
- CI workflow now directly triggers preview deployment via workflow_dispatch
- Remove dependency on unreliable workflow_run triggers
- Use github-script action for robust API calls with proper error handling
- Add new 'ci_triggered' source type for tracking
- Ensure preview deployment happens immediately after CI success
- Maintain all existing fallback mechanisms for reliability
- Replace complex workflow_dispatch with simple status events
- CI creates commit status 'ci/preview-ready' when all tests pass
- Preview workflow triggers on status events (instant and reliable)
- Remove all permission-dependent triggering mechanisms
- Simplify logic - status event = CI passed = deploy immediately
- This approach works with default GITHUB_TOKEN permissions
Aswin-coder
Aswin-coder previously approved these changes Aug 16, 2025
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