diff --git a/apps/dokploy/pages/api/deploy/github.ts b/apps/dokploy/pages/api/deploy/github.ts index 9369e800e..ba031e71a 100644 --- a/apps/dokploy/pages/api/deploy/github.ts +++ b/apps/dokploy/pages/api/deploy/github.ts @@ -355,6 +355,11 @@ export default async function handler( action === "labeled" || action === "unlabeled" ) { + const shouldCreateDeployment = + action === "opened" || + action === "synchronize" || + action === "reopened"; + const repository = githubBody?.repository?.name; const deploymentHash = githubBody?.pull_request?.head?.sha; const branch = githubBody?.pull_request?.base?.ref; @@ -475,7 +480,7 @@ export default async function handler( let previewDeploymentId = previewDeploymentResult?.previewDeploymentId || ""; - if (!previewDeploymentResult) { + if (!previewDeploymentResult && shouldCreateDeployment) { const previewDeployment = await createPreviewDeployment({ applicationId: app.applicationId as string, branch: prBranch, @@ -497,21 +502,23 @@ export default async function handler( previewDeploymentId, }; - if (IS_CLOUD && app.serverId) { - jobData.serverId = app.serverId; - deploy(jobData).catch((error) => { - console.error("Background deployment failed:", error); - }); - continue; + if (previewDeploymentId) { + if (IS_CLOUD && app.serverId) { + jobData.serverId = app.serverId; + deploy(jobData).catch((error) => { + console.error("Background deployment failed:", error); + }); + continue; + } + await myQueue.add( + "deployments", + { ...jobData }, + { + removeOnComplete: true, + removeOnFail: true, + }, + ); } - await myQueue.add( - "deployments", - { ...jobData }, - { - removeOnComplete: true, - removeOnFail: true, - }, - ); } return res.status(200).json({ message: "Apps Deployed" }); } diff --git a/packages/server/src/lib/auth.ts b/packages/server/src/lib/auth.ts index 656ac4116..bf4787a89 100644 --- a/packages/server/src/lib/auth.ts +++ b/packages/server/src/lib/auth.ts @@ -57,7 +57,10 @@ const { handler, api } = betterAuth({ ...(settings?.serverIp ? [`http://${settings?.serverIp}:3000`] : []), ...(settings?.host ? [`https://${settings?.host}`] : []), ...(process.env.NODE_ENV === "development" - ? ["http://localhost:3000"] + ? [ + "http://localhost:3000", + "https://absolutely-handy-falcon.ngrok-free.app", + ] : []), ...trustedOrigins, ];