@@ -3,7 +3,8 @@ import { parse } from "@conform-to/zod";
33import { CheckCircleIcon , LockClosedIcon , PlusIcon } from "@heroicons/react/20/solid" ;
44import { Form , useActionData , useNavigation , useNavigate , useSearchParams , useLocation } from "@remix-run/react" ;
55import { type ActionFunctionArgs , type LoaderFunctionArgs , json } from "@remix-run/server-runtime" ;
6- import { typedjson , useTypedFetcher } from "remix-typedjson" ;
6+ import { redirect ,
7+ typedjson , useTypedFetcher } from "remix-typedjson" ;
78import { z } from "zod" ;
89import { OctoKitty } from "~/components/GitHubLoginButton" ;
910import { Dialog , DialogContent , DialogHeader , DialogTrigger } from "~/components/primitives/Dialog" ;
@@ -39,6 +40,7 @@ import { findProjectBySlug } from "~/models/project.server";
3940import { findEnvironmentBySlug } from "~/models/runtimeEnvironment.server" ;
4041import { ProjectSettingsService } from "~/services/projectSettings.server" ;
4142import { logger } from "~/services/logger.server" ;
43+ import { triggerInitialDeployment } from "~/services/platform.v3.server" ;
4244import { requireUserId } from "~/services/session.server" ;
4345import {
4446 githubAppInstallPath ,
@@ -208,6 +210,18 @@ export async function action({ request, params }: ActionFunctionArgs) {
208210 ) ;
209211
210212 if ( resultOrFail . isOk ( ) ) {
213+ // Trigger initial deployment for marketplace flows now that GitHub is connected
214+ if ( redirectUrl ) {
215+ try {
216+ if ( redirectUrl . includes ( "origin=marketplace" ) ) {
217+ await triggerInitialDeployment ( projectId , { environment : "prod" } ) ;
218+ }
219+ } catch ( error ) {
220+ logger . error ( "Invalid redirect URL, skipping initial deployment trigger" , { redirectUrl, error } ) ;
221+ // Invalid redirectUrl, skip initial deployment check
222+ }
223+ }
224+
211225 return redirectWithMessage (
212226 request ,
213227 redirectUrl ,
0 commit comments