mirror of
https://github.com/Dokploy/dokploy.git
synced 2026-06-21 07:05:21 +02:00
feat(deployment): add support for Soft Serve webhooks
This commit is contained in:
@@ -159,6 +159,10 @@ export default async function handler(
|
||||
normalizedCommits = req.body?.commits?.flatMap(
|
||||
(commit: any) => commit.modified,
|
||||
);
|
||||
} else if (provider === "soft-serve") {
|
||||
normalizedCommits = req.body?.commits?.flatMap(
|
||||
(commit: any) => commit.modified,
|
||||
);
|
||||
}
|
||||
|
||||
const shouldDeployPaths = shouldDeploy(
|
||||
@@ -442,6 +446,13 @@ export const extractCommitMessage = (headers: any, body: any) => {
|
||||
: "NEW COMMIT";
|
||||
}
|
||||
|
||||
// Soft Serve
|
||||
if (headers["x-softserve-event"]) {
|
||||
return body.commits && body.commits.length > 0
|
||||
? body.commits[0].message
|
||||
: "NEW COMMIT";
|
||||
}
|
||||
|
||||
if (headers["user-agent"]?.includes("Go-http-client")) {
|
||||
if (body.push_data && body.repository) {
|
||||
return `DockerHub image pushed: ${body.repository.repo_name}:${body.push_data.tag} by ${body.push_data.pusher}`;
|
||||
@@ -479,6 +490,11 @@ export const extractHash = (headers: any, body: any) => {
|
||||
return body.after || "NEW COMMIT";
|
||||
}
|
||||
|
||||
// Soft Serve
|
||||
if (headers["x-softserve-event"]) {
|
||||
return body.after || "NEW COMMIT";
|
||||
}
|
||||
|
||||
return "";
|
||||
};
|
||||
|
||||
@@ -495,6 +511,10 @@ export const extractBranchName = (headers: any, body: any) => {
|
||||
return body?.push?.changes[0]?.new?.name;
|
||||
}
|
||||
|
||||
if (headers["x-softserve-event"]?.includes("push")) {
|
||||
return body?.ref ? body?.ref.replace("refs/heads/", "") : null;
|
||||
}
|
||||
|
||||
return null;
|
||||
};
|
||||
|
||||
@@ -515,6 +535,10 @@ export const getProviderByHeader = (headers: any) => {
|
||||
return "bitbucket";
|
||||
}
|
||||
|
||||
if (headers["x-softserve-event"]) {
|
||||
return "soft-serve";
|
||||
}
|
||||
|
||||
return null;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user