Merge pull request #4772 from rifatdinc/fix-watch-paths-added-removed-files
Some checks are pending
Auto PR to main when version changes / create-pr (push) Waiting to run
Build Docker images / build-and-push-cloud-image (push) Waiting to run
Build Docker images / build-and-push-schedule-image (push) Waiting to run
Build Docker images / build-and-push-server-image (push) Waiting to run
Dokploy Docker Build / docker-amd (push) Waiting to run
Dokploy Docker Build / docker-arm (push) Waiting to run
Dokploy Docker Build / combine-manifests (push) Blocked by required conditions
Dokploy Docker Build / generate-release (push) Blocked by required conditions
Dokploy Docker Build / sync-version (push) Blocked by required conditions
autofix.ci / format (push) Waiting to run
Dokploy Monitoring Build / docker-amd (push) Waiting to run
Dokploy Monitoring Build / docker-arm (push) Waiting to run
Dokploy Monitoring Build / combine-manifests (push) Blocked by required conditions

fix(webhook): include added and removed files in watchPaths validation
This commit is contained in:
Narciso E. Núñez Arias 2026-08-05 22:21:12 -04:00 committed by GitHub
commit 3f98208f03
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 70 additions and 42 deletions

View File

@ -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,

View File

@ -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,

View File

@ -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(