feat: deployment approval UI and backend handlers#5256
feat: deployment approval UI and backend handlers#5256Flo4604 merged 21 commits intofeat/external-contributor-protectionfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
This stack of pull requests is managed by Graphite. Learn more about stacking. |
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
📝 Coding Plan
Comment |
d315940 to
cc70395
Compare
36216f3 to
66dad62
Compare
cc70395 to
5eeb2b0
Compare
66dad62 to
4f7c6e8
Compare
4f7c6e8 to
24ccc92
Compare
5eeb2b0 to
990e123
Compare
24ccc92 to
fc52cb0
Compare
990e123 to
9edfbae
Compare
9edfbae to
d034877
Compare
fc52cb0 to
4fea8a6
Compare
d034877 to
60772bf
Compare
4fea8a6 to
0edf2ec
Compare
60772bf to
6a191d7
Compare
0edf2ec to
be84e80
Compare
6a191d7 to
a808725
Compare
a808725 to
adf6636
Compare
ec39be3 to
de084e0
Compare
653be32 to
37d6876
Compare
228d914 to
1f59d61
Compare
37d6876 to
64f8baa
Compare
Add the complete approval/rejection flow for gated deployments: Backend (ctrl service): - Add ApproveDeployment and RejectDeployment RPCs to DeployService proto - Implement approve handler: validates status, updates to pending, records approval, triggers deploy workflow via Restate - Implement reject handler: validates status, updates to failed - Add FindAppBuildSettingByAppEnv SQL query for approval flow Dashboard: - Add awaiting_approval to deployment status badges, filters, and collection - Add DeploymentApprovalBanner component with approve/reject buttons - Show banner on deployment detail page when awaiting approval - Add tRPC mutations for approve/reject calling ctrl service - Add deployment.approve and deployment.reject audit log events
- Add 'rejected' to deployment status badges, filters, and collections - Add DeploymentRejectedBanner with red error styling - Show rejected banner on deployment detail page - Add rejected to grouped status filter with error color
Remove deployment approval/rejection banners, status badge configs, filter options, and tRPC routes for awaiting_approval/rejected statuses. Add /projects/[projectId]/authorize page that reads branch from URL params and calls AuthorizeDeployment RPC. Add authorize tRPC route.
The ctrl API needs GitHub App credentials to fetch branch HEAD when authorizing deployments from external contributors.
- Remove awaiting_approval and rejected from deployment statuses, filters, and status badge configs (no longer used — authorization is handled via GitHub Check Runs, not deployment status) - Remove deployment.approve and deployment.reject audit log events - Delete unused duplicate deployment-status-badge.tsx in table components - Fix broken page.tsx referencing undefined awaitingApproval/rejected vars - Extract createCtrlClient helper to deduplicate identical ctrl client creation boilerplate across 9 trpc router files
Centered layout with GitHub + shield icons, commit details card showing branch/SHA/message/sender from URL query params, proper Button components, success/error states, and non-member handling hint.
Frontend now validates SHA format (40-char hex) before allowing authorization and passes it to the backend which verifies it matches the branch HEAD.
Instead of a generic error, show a clear message explaining the branch has new commits and direct the user to GitHub to find the latest authorization link.
Instead of telling the user to check GitHub, parse the new HEAD SHA from the backend error and offer a direct "View Latest Commit" button that navigates to the updated authorize page.
…om DB - Rewrite authorize page to take single deploymentId search param - Fetch deployment details from DB via getById instead of URL params - Handle awaiting_approval, already authorized, and failed states - Simplify authorize mutation input to just deploymentId - Add gitCommitMessage, gitCommitAuthorHandle, gitCommitAuthorAvatarUrl, projectId to getById response - Register getById in tRPC router
Replace the separate /authorize page with an inline DeploymentApproval component shown when deployment status is awaiting_approval. Delete the standalone authorize page. Add awaiting_approval to deriveStatusFromSteps valid statuses so it doesn't fall back to pending.

What does this PR do?
Adds GitHub Check Runs support for deployment authorization workflow. When external contributors push to protected branches, the system now creates visible check runs in GitHub PRs that require project member authorization before deployments can proceed.
The implementation includes:
When testing:::
Please ensure your app has the following permissions(this is important for prod too)!!
then go into https://github.com/settings/installations and find your app and re-approve the perms.
For testing the happy path:
FORCE_DEPLOYMENT_APPROVALshould be set to false in the yaml file.Fixes # (issue)
Type of change
How should this be tested?
Checklist
Required
pnpm buildpnpm fmtmake fmton/godirectoryconsole.logsgit pull origin mainAppreciated