mirror of
https://github.com/Dokploy/dokploy
synced 2025-06-26 18:27:59 +00:00
Merge pull request #1204 from gentslava/fix/issue_1198-muliple_preview_deployments
fix: Multiple Preview Deployments
This commit is contained in:
@@ -182,8 +182,9 @@ export default async function handler(
|
|||||||
}
|
}
|
||||||
} else if (req.headers["x-github-event"] === "pull_request") {
|
} else if (req.headers["x-github-event"] === "pull_request") {
|
||||||
const prId = githubBody?.pull_request?.id;
|
const prId = githubBody?.pull_request?.id;
|
||||||
|
const action = githubBody?.action;
|
||||||
|
|
||||||
if (githubBody?.action === "closed") {
|
if (action === "closed") {
|
||||||
const previewDeploymentResult =
|
const previewDeploymentResult =
|
||||||
await findPreviewDeploymentsByPullRequestId(prId);
|
await findPreviewDeploymentsByPullRequestId(prId);
|
||||||
|
|
||||||
@@ -201,7 +202,13 @@ export default async function handler(
|
|||||||
res.status(200).json({ message: "Preview Deployment Closed" });
|
res.status(200).json({ message: "Preview Deployment Closed" });
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// opened or synchronize or reopened
|
// opened or synchronize or reopened
|
||||||
|
if (
|
||||||
|
action === "opened" ||
|
||||||
|
action === "synchronize" ||
|
||||||
|
action === "reopened"
|
||||||
|
) {
|
||||||
const repository = githubBody?.repository?.name;
|
const repository = githubBody?.repository?.name;
|
||||||
const deploymentHash = githubBody?.pull_request?.head?.sha;
|
const deploymentHash = githubBody?.pull_request?.head?.sha;
|
||||||
const branch = githubBody?.pull_request?.base?.ref;
|
const branch = githubBody?.pull_request?.base?.ref;
|
||||||
@@ -262,7 +269,7 @@ export default async function handler(
|
|||||||
if (IS_CLOUD && app.serverId) {
|
if (IS_CLOUD && app.serverId) {
|
||||||
jobData.serverId = app.serverId;
|
jobData.serverId = app.serverId;
|
||||||
await deploy(jobData);
|
await deploy(jobData);
|
||||||
return true;
|
continue;
|
||||||
}
|
}
|
||||||
await myQueue.add(
|
await myQueue.add(
|
||||||
"deployments",
|
"deployments",
|
||||||
@@ -275,6 +282,7 @@ export default async function handler(
|
|||||||
}
|
}
|
||||||
return res.status(200).json({ message: "Apps Deployed" });
|
return res.status(200).json({ message: "Apps Deployed" });
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return res.status(400).json({ message: "No Actions matched" });
|
return res.status(400).json({ message: "No Actions matched" });
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user