return undefined if there is no match

Signed-off-by: Kiss Miklos <miklos@roadie.io>
This commit is contained in:
Kiss Miklos
2023-03-13 10:18:46 +01:00
parent 9d6c429801
commit f235e4064f
@@ -30,13 +30,7 @@ export function resolveCodeOwner(
const { filepath } = parseGitUrl(catalogInfoFileUrl);
const match = codeowners.matchFile(filepath, codeOwnerEntries);
if (!match) {
throw new Error(
`There is no matching entry for path: ${filepath} in the CODEOWNERS file`,
);
}
return normalizeCodeOwner(match.owners[0]);
return match ? normalizeCodeOwner(match.owners[0]) : undefined;
}
export function normalizeCodeOwner(owner: string) {