@@ -79,11 +79,13 @@ export class CodeOwnersProcessor implements CatalogProcessor {
|
||||
if (!scmIntegration) {
|
||||
return entity;
|
||||
}
|
||||
|
||||
const pattern =
|
||||
entity.metadata?.annotations['backstage.io/managed-by-location'];
|
||||
const owner = await findCodeOwnerByTarget(
|
||||
this.reader,
|
||||
location.target,
|
||||
scmIntegration,
|
||||
pattern,
|
||||
);
|
||||
|
||||
if (!owner) {
|
||||
|
||||
@@ -52,6 +52,7 @@ export async function findCodeOwnerByTarget(
|
||||
reader: UrlReader,
|
||||
targetUrl: string,
|
||||
scmIntegration: ScmIntegration,
|
||||
pattern: string,
|
||||
): Promise<string | undefined> {
|
||||
const codeownersPaths = scmCodeOwnersPaths[scmIntegration?.type ?? ''];
|
||||
|
||||
@@ -70,7 +71,7 @@ export async function findCodeOwnerByTarget(
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const owner = resolveCodeOwner(contents);
|
||||
const owner = resolveCodeOwner(contents, pattern);
|
||||
|
||||
return owner;
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ export function resolveCodeOwner(
|
||||
const owners = codeowners.parse(contents);
|
||||
|
||||
return pipe(
|
||||
filter((e: CodeOwnersEntry) => e.pattern === pattern),
|
||||
filter((e: CodeOwnersEntry) => pattern.includes(e.pattern)),
|
||||
reverse,
|
||||
head,
|
||||
get('owners'),
|
||||
|
||||
Reference in New Issue
Block a user