mirror of
https://github.com/Dokploy/dokploy.git
synced 2026-06-15 20:25:23 +02:00
fix: also collect added/removed paths and filter nullish values
commit.modified can be undefined causing micromatch to throw "Expected input to be a string". Also includes added and removed paths from commits so watch paths can match against all changed files.
This commit is contained in:
@@ -54,7 +54,11 @@ export default async function handler(
|
|||||||
if (sourceType === "github") {
|
if (sourceType === "github") {
|
||||||
const branchName = extractBranchName(req.headers, req.body);
|
const branchName = extractBranchName(req.headers, req.body);
|
||||||
const normalizedCommits =
|
const normalizedCommits =
|
||||||
req.body?.commits?.flatMap((commit: any) => commit.modified) || [];
|
req.body?.commits?.flatMap((commit: any) => [
|
||||||
|
...(commit.modified || []),
|
||||||
|
...(commit.added || []),
|
||||||
|
...(commit.removed || []),
|
||||||
|
]).filter(Boolean) || [];
|
||||||
|
|
||||||
const shouldDeployPaths = shouldDeploy(
|
const shouldDeployPaths = shouldDeploy(
|
||||||
composeResult.watchPaths,
|
composeResult.watchPaths,
|
||||||
@@ -73,7 +77,11 @@ export default async function handler(
|
|||||||
} else if (sourceType === "gitlab") {
|
} else if (sourceType === "gitlab") {
|
||||||
const branchName = extractBranchName(req.headers, req.body);
|
const branchName = extractBranchName(req.headers, req.body);
|
||||||
const normalizedCommits =
|
const normalizedCommits =
|
||||||
req.body?.commits?.flatMap((commit: any) => commit.modified) || [];
|
req.body?.commits?.flatMap((commit: any) => [
|
||||||
|
...(commit.modified || []),
|
||||||
|
...(commit.added || []),
|
||||||
|
...(commit.removed || []),
|
||||||
|
]).filter(Boolean) || [];
|
||||||
|
|
||||||
const shouldDeployPaths = shouldDeploy(
|
const shouldDeployPaths = shouldDeploy(
|
||||||
composeResult.watchPaths,
|
composeResult.watchPaths,
|
||||||
@@ -123,13 +131,25 @@ export default async function handler(
|
|||||||
|
|
||||||
if (provider === "github") {
|
if (provider === "github") {
|
||||||
normalizedCommits =
|
normalizedCommits =
|
||||||
req.body?.commits?.flatMap((commit: any) => commit.modified) || [];
|
req.body?.commits?.flatMap((commit: any) => [
|
||||||
|
...(commit.modified || []),
|
||||||
|
...(commit.added || []),
|
||||||
|
...(commit.removed || []),
|
||||||
|
]).filter(Boolean) || [];
|
||||||
} else if (provider === "gitlab") {
|
} else if (provider === "gitlab") {
|
||||||
normalizedCommits =
|
normalizedCommits =
|
||||||
req.body?.commits?.flatMap((commit: any) => commit.modified) || [];
|
req.body?.commits?.flatMap((commit: any) => [
|
||||||
|
...(commit.modified || []),
|
||||||
|
...(commit.added || []),
|
||||||
|
...(commit.removed || []),
|
||||||
|
]).filter(Boolean) || [];
|
||||||
} else if (provider === "gitea") {
|
} else if (provider === "gitea") {
|
||||||
normalizedCommits =
|
normalizedCommits =
|
||||||
req.body?.commits?.flatMap((commit: any) => commit.modified) || [];
|
req.body?.commits?.flatMap((commit: any) => [
|
||||||
|
...(commit.modified || []),
|
||||||
|
...(commit.added || []),
|
||||||
|
...(commit.removed || []),
|
||||||
|
]).filter(Boolean) || [];
|
||||||
}
|
}
|
||||||
|
|
||||||
const shouldDeployPaths = shouldDeploy(
|
const shouldDeployPaths = shouldDeploy(
|
||||||
@@ -145,7 +165,11 @@ export default async function handler(
|
|||||||
const branchName = extractBranchName(req.headers, req.body);
|
const branchName = extractBranchName(req.headers, req.body);
|
||||||
|
|
||||||
const normalizedCommits =
|
const normalizedCommits =
|
||||||
req.body?.commits?.flatMap((commit: any) => commit.modified) || [];
|
req.body?.commits?.flatMap((commit: any) => [
|
||||||
|
...(commit.modified || []),
|
||||||
|
...(commit.added || []),
|
||||||
|
...(commit.removed || []),
|
||||||
|
]).filter(Boolean) || [];
|
||||||
|
|
||||||
const shouldDeployPaths = shouldDeploy(
|
const shouldDeployPaths = shouldDeploy(
|
||||||
composeResult.watchPaths,
|
composeResult.watchPaths,
|
||||||
|
|||||||
@@ -214,7 +214,11 @@ export default async function handler(
|
|||||||
const deploymentHash = extractHash(req.headers, req.body);
|
const deploymentHash = extractHash(req.headers, req.body);
|
||||||
const owner = githubBody?.repository?.owner?.name;
|
const owner = githubBody?.repository?.owner?.name;
|
||||||
const normalizedCommits =
|
const normalizedCommits =
|
||||||
githubBody?.commits?.flatMap((commit: any) => commit.modified) || [];
|
githubBody?.commits?.flatMap((commit: any) => [
|
||||||
|
...(commit.modified || []),
|
||||||
|
...(commit.added || []),
|
||||||
|
...(commit.removed || []),
|
||||||
|
]).filter(Boolean) || [];
|
||||||
|
|
||||||
const apps = await db.query.applications.findMany({
|
const apps = await db.query.applications.findMany({
|
||||||
where: and(
|
where: and(
|
||||||
|
|||||||
Reference in New Issue
Block a user