mirror of
https://github.com/Dokploy/dokploy
synced 2025-06-26 18:27:59 +00:00
Fix Gitea watch branch validation logic
This commit is contained in:
parent
56d8defebe
commit
a4e4d1c467
@ -130,6 +130,21 @@ export default async function handler(
|
|||||||
}
|
}
|
||||||
} else if (sourceType === "gitea") {
|
} else if (sourceType === "gitea") {
|
||||||
const branchName = extractBranchName(req.headers, req.body);
|
const branchName = extractBranchName(req.headers, req.body);
|
||||||
|
|
||||||
|
const normalizedCommits = req.body?.commits?.flatMap(
|
||||||
|
(commit: any) => commit.modified,
|
||||||
|
);
|
||||||
|
|
||||||
|
const shouldDeployPaths = shouldDeploy(
|
||||||
|
application.watchPaths,
|
||||||
|
normalizedCommits,
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!shouldDeployPaths) {
|
||||||
|
res.status(301).json({ message: "Watch Paths Not Match" });
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!branchName || branchName !== application.giteaBranch) {
|
if (!branchName || branchName !== application.giteaBranch) {
|
||||||
res.status(301).json({ message: "Branch Not Match" });
|
res.status(301).json({ message: "Branch Not Match" });
|
||||||
return;
|
return;
|
||||||
@ -230,12 +245,6 @@ export const extractCommitMessage = (headers: any, body: any) => {
|
|||||||
: "NEW COMMIT";
|
: "NEW COMMIT";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (headers["user-agent"]?.includes("Go-http-client")) {
|
|
||||||
if (body.push_data && body.repository) {
|
|
||||||
return `Docker image pushed: ${body.repository.repo_name}:${body.push_data.tag} by ${body.push_data.pusher}`;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return "NEW CHANGES";
|
return "NEW CHANGES";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user