mirror of
https://github.com/andwati/dokploy.git
synced 2026-11-25 05:08:46 +00: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(
|
normalizedCommits = req.body?.commits?.flatMap(
|
||||||
(commit: any) => commit.modified,
|
(commit: any) => commit.modified,
|
||||||
);
|
);
|
||||||
|
} else if (provider === "soft-serve") {
|
||||||
|
normalizedCommits = req.body?.commits?.flatMap(
|
||||||
|
(commit: any) => commit.modified,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const shouldDeployPaths = shouldDeploy(
|
const shouldDeployPaths = shouldDeploy(
|
||||||
@@ -442,6 +446,13 @@ export const extractCommitMessage = (headers: any, body: any) => {
|
|||||||
: "NEW COMMIT";
|
: "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 (headers["user-agent"]?.includes("Go-http-client")) {
|
||||||
if (body.push_data && body.repository) {
|
if (body.push_data && body.repository) {
|
||||||
return `DockerHub image pushed: ${body.repository.repo_name}:${body.push_data.tag} by ${body.push_data.pusher}`;
|
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";
|
return body.after || "NEW COMMIT";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Soft Serve
|
||||||
|
if (headers["x-softserve-event"]) {
|
||||||
|
return body.after || "NEW COMMIT";
|
||||||
|
}
|
||||||
|
|
||||||
return "";
|
return "";
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -495,6 +511,10 @@ export const extractBranchName = (headers: any, body: any) => {
|
|||||||
return body?.push?.changes[0]?.new?.name;
|
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;
|
return null;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -515,6 +535,10 @@ export const getProviderByHeader = (headers: any) => {
|
|||||||
return "bitbucket";
|
return "bitbucket";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (headers["x-softserve-event"]) {
|
||||||
|
return "soft-serve";
|
||||||
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user