mirror of
https://github.com/Dokploy/dokploy.git
synced 2026-09-14 11:06:15 +05:00
Merge pull request #4772 from rifatdinc/fix-watch-paths-added-removed-files
fix(webhook): include added and removed files in watchPaths validation
(cherry picked from commit 3f98208f03)
This commit is contained in:
parent
e19d7bbf0e
commit
bcf97f92ab
@ -119,9 +119,11 @@ export default async function handler(
|
||||
}
|
||||
// If webhook doesn't provide image info, we'll use the configured image (old behavior)
|
||||
} else if (sourceType === "github") {
|
||||
const normalizedCommits = req.body?.commits?.flatMap(
|
||||
(commit: any) => commit.modified,
|
||||
);
|
||||
const normalizedCommits = req.body?.commits?.flatMap((commit: any) => [
|
||||
...(commit.added || []),
|
||||
...(commit.modified || []),
|
||||
...(commit.removed || []),
|
||||
]);
|
||||
|
||||
const shouldDeployPaths = shouldDeploy(
|
||||
application.watchPaths,
|
||||
@ -150,21 +152,29 @@ export default async function handler(
|
||||
let normalizedCommits: string[] = [];
|
||||
|
||||
if (provider === "github") {
|
||||
normalizedCommits = req.body?.commits?.flatMap(
|
||||
(commit: any) => commit.modified,
|
||||
);
|
||||
normalizedCommits = req.body?.commits?.flatMap((commit: any) => [
|
||||
...(commit.added || []),
|
||||
...(commit.modified || []),
|
||||
...(commit.removed || []),
|
||||
]);
|
||||
} else if (provider === "gitlab") {
|
||||
normalizedCommits = req.body?.commits?.flatMap(
|
||||
(commit: any) => commit.modified,
|
||||
);
|
||||
normalizedCommits = req.body?.commits?.flatMap((commit: any) => [
|
||||
...(commit.added || []),
|
||||
...(commit.modified || []),
|
||||
...(commit.removed || []),
|
||||
]);
|
||||
} else if (provider === "gitea") {
|
||||
normalizedCommits = req.body?.commits?.flatMap(
|
||||
(commit: any) => commit.modified,
|
||||
);
|
||||
normalizedCommits = req.body?.commits?.flatMap((commit: any) => [
|
||||
...(commit.added || []),
|
||||
...(commit.modified || []),
|
||||
...(commit.removed || []),
|
||||
]);
|
||||
} else if (provider === "soft-serve") {
|
||||
normalizedCommits = req.body?.commits?.flatMap(
|
||||
(commit: any) => commit.modified,
|
||||
);
|
||||
normalizedCommits = req.body?.commits?.flatMap((commit: any) => [
|
||||
...(commit.added || []),
|
||||
...(commit.modified || []),
|
||||
...(commit.removed || []),
|
||||
]);
|
||||
}
|
||||
|
||||
const shouldDeployPaths = shouldDeploy(
|
||||
@ -179,9 +189,11 @@ export default async function handler(
|
||||
} else if (sourceType === "gitlab") {
|
||||
const branchName = extractBranchName(req.headers, req.body);
|
||||
|
||||
const normalizedCommits = req.body?.commits?.flatMap(
|
||||
(commit: any) => commit.modified,
|
||||
);
|
||||
const normalizedCommits = req.body?.commits?.flatMap((commit: any) => [
|
||||
...(commit.added || []),
|
||||
...(commit.modified || []),
|
||||
...(commit.removed || []),
|
||||
]);
|
||||
|
||||
const shouldDeployPaths = shouldDeploy(
|
||||
application.watchPaths,
|
||||
@ -225,9 +237,11 @@ export default async function handler(
|
||||
} else if (sourceType === "gitea") {
|
||||
const branchName = extractBranchName(req.headers, req.body);
|
||||
|
||||
const normalizedCommits = req.body?.commits?.flatMap(
|
||||
(commit: any) => commit.modified,
|
||||
);
|
||||
const normalizedCommits = req.body?.commits?.flatMap((commit: any) => [
|
||||
...(commit.added || []),
|
||||
...(commit.modified || []),
|
||||
...(commit.removed || []),
|
||||
]);
|
||||
|
||||
const shouldDeployPaths = shouldDeploy(
|
||||
application.watchPaths,
|
||||
|
||||
@ -54,9 +54,11 @@ export default async function handler(
|
||||
|
||||
if (sourceType === "github") {
|
||||
const branchName = extractBranchName(req.headers, req.body);
|
||||
const normalizedCommits = req.body?.commits?.flatMap(
|
||||
(commit: any) => commit.modified,
|
||||
);
|
||||
const normalizedCommits = req.body?.commits?.flatMap((commit: any) => [
|
||||
...(commit.added || []),
|
||||
...(commit.modified || []),
|
||||
...(commit.removed || []),
|
||||
]);
|
||||
|
||||
const shouldDeployPaths = shouldDeploy(
|
||||
composeResult.watchPaths,
|
||||
@ -74,9 +76,11 @@ export default async function handler(
|
||||
}
|
||||
} else if (sourceType === "gitlab") {
|
||||
const branchName = extractBranchName(req.headers, req.body);
|
||||
const normalizedCommits = req.body?.commits?.flatMap(
|
||||
(commit: any) => commit.modified,
|
||||
);
|
||||
const normalizedCommits = req.body?.commits?.flatMap((commit: any) => [
|
||||
...(commit.added || []),
|
||||
...(commit.modified || []),
|
||||
...(commit.removed || []),
|
||||
]);
|
||||
|
||||
const shouldDeployPaths = shouldDeploy(
|
||||
composeResult.watchPaths,
|
||||
@ -125,17 +129,23 @@ export default async function handler(
|
||||
let normalizedCommits: string[] = [];
|
||||
|
||||
if (provider === "github") {
|
||||
normalizedCommits = req.body?.commits?.flatMap(
|
||||
(commit: any) => commit.modified,
|
||||
);
|
||||
normalizedCommits = req.body?.commits?.flatMap((commit: any) => [
|
||||
...(commit.added || []),
|
||||
...(commit.modified || []),
|
||||
...(commit.removed || []),
|
||||
]);
|
||||
} else if (provider === "gitlab") {
|
||||
normalizedCommits = req.body?.commits?.flatMap(
|
||||
(commit: any) => commit.modified,
|
||||
);
|
||||
normalizedCommits = req.body?.commits?.flatMap((commit: any) => [
|
||||
...(commit.added || []),
|
||||
...(commit.modified || []),
|
||||
...(commit.removed || []),
|
||||
]);
|
||||
} else if (provider === "gitea") {
|
||||
normalizedCommits = req.body?.commits?.flatMap(
|
||||
(commit: any) => commit.modified,
|
||||
);
|
||||
normalizedCommits = req.body?.commits?.flatMap((commit: any) => [
|
||||
...(commit.added || []),
|
||||
...(commit.modified || []),
|
||||
...(commit.removed || []),
|
||||
]);
|
||||
}
|
||||
|
||||
const shouldDeployPaths = shouldDeploy(
|
||||
@ -150,9 +160,11 @@ export default async function handler(
|
||||
} else if (sourceType === "gitea") {
|
||||
const branchName = extractBranchName(req.headers, req.body);
|
||||
|
||||
const normalizedCommits = req.body?.commits?.flatMap(
|
||||
(commit: any) => commit.modified,
|
||||
);
|
||||
const normalizedCommits = req.body?.commits?.flatMap((commit: any) => [
|
||||
...(commit.added || []),
|
||||
...(commit.modified || []),
|
||||
...(commit.removed || []),
|
||||
]);
|
||||
|
||||
const shouldDeployPaths = shouldDeploy(
|
||||
composeResult.watchPaths,
|
||||
|
||||
@ -223,9 +223,11 @@ export default async function handler(
|
||||
const deploymentTitle = extractCommitMessage(req.headers, req.body);
|
||||
const deploymentHash = extractHash(req.headers, req.body);
|
||||
const owner = getGithubRepositoryOwner(githubBody);
|
||||
const normalizedCommits = githubBody?.commits?.flatMap(
|
||||
(commit: any) => commit.modified,
|
||||
);
|
||||
const normalizedCommits = githubBody?.commits?.flatMap((commit: any) => [
|
||||
...(commit.added || []),
|
||||
...(commit.modified || []),
|
||||
...(commit.removed || []),
|
||||
]);
|
||||
|
||||
const apps = await db.query.applications.findMany({
|
||||
where: and(
|
||||
|
||||
Loading…
Reference in New Issue
Block a user