fix(catalog-backend): fix codeowners processor to handle users
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@backstage/plugin-catalog-backend': patch
|
||||
---
|
||||
|
||||
Fix CodeOwnersProcessor to handle non team users
|
||||
@@ -123,6 +123,10 @@ describe('CodeOwnersProcessor', () => {
|
||||
});
|
||||
|
||||
describe('normalizeCodeOwner', () => {
|
||||
it('should remove the @ symbol', () => {
|
||||
expect(normalizeCodeOwner('@yoda')).toBe('yoda');
|
||||
});
|
||||
|
||||
it('should remove org from org/team format', () => {
|
||||
expect(normalizeCodeOwner('@acme/foo')).toBe('foo');
|
||||
});
|
||||
|
||||
@@ -127,6 +127,8 @@ export function findPrimaryCodeOwner(
|
||||
export function normalizeCodeOwner(owner: string) {
|
||||
if (owner.match(/^@.*\/.*/)) {
|
||||
return owner.split('/')[1];
|
||||
} else if (owner.match(/^@.*/)) {
|
||||
return owner.substring(1);
|
||||
} else if (owner.match(/^.*@.*\..*$/)) {
|
||||
return owner.split('@')[0];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user