mirror of
https://github.com/dokploy/dokploy.git
synced 2026-06-14 03:19:49 +00:00
fix: prevent webhook deploy crash when commit data lacks modified files (#4470)
shouldDeploy passed undefined/null entries from commit.modified straight into micromatch, which throws "Expected input to be a string" and fails every webhook deployment when watch paths are configured. Filter out non-string values before matching.
This commit is contained in:
@@ -2,8 +2,11 @@ import micromatch from "micromatch";
|
||||
|
||||
export const shouldDeploy = (
|
||||
watchPaths: string[] | null,
|
||||
modifiedFiles: string[],
|
||||
modifiedFiles: (string | null | undefined)[] | null | undefined,
|
||||
): boolean => {
|
||||
if (!watchPaths || watchPaths?.length === 0) return true;
|
||||
return micromatch.some(modifiedFiles, watchPaths);
|
||||
const files = (modifiedFiles ?? []).filter(
|
||||
(file): file is string => typeof file === "string",
|
||||
);
|
||||
return micromatch.some(files, watchPaths);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user