From 0109d3f11159ff5ba894654f7938e3ddb2355709 Mon Sep 17 00:00:00 2001 From: Eric Peterson Date: Mon, 21 Aug 2023 09:48:49 +0200 Subject: [PATCH] Default created entities to using the first listed CODEOWNER as owner. Co-authored-by: Jonatan Dahl Signed-off-by: Eric Peterson --- .changeset/repo-p-lisa.md | 7 +++++++ .../src/commands/generate-catalog-info/codeowners.ts | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 .changeset/repo-p-lisa.md diff --git a/.changeset/repo-p-lisa.md b/.changeset/repo-p-lisa.md new file mode 100644 index 0000000000..d6a0fa56f4 --- /dev/null +++ b/.changeset/repo-p-lisa.md @@ -0,0 +1,7 @@ +--- +'@backstage/repo-tools': patch +--- + +The `generate-catalog-info` command now uses the first listed `CODEOWNER` as Component owner when initially +creating the `catalog-info.yaml` file. It continues to allow any one listed `CODEOWNER` when updating +entity metadata. diff --git a/packages/repo-tools/src/commands/generate-catalog-info/codeowners.ts b/packages/repo-tools/src/commands/generate-catalog-info/codeowners.ts index f485e872e9..25703e4fc2 100644 --- a/packages/repo-tools/src/commands/generate-catalog-info/codeowners.ts +++ b/packages/repo-tools/src/commands/generate-catalog-info/codeowners.ts @@ -59,7 +59,7 @@ export function getOwnerFromCodeowners( ): string { const relPath = relativePath('.', absPath); const possibleOwners = getPossibleCodeowners(codeowners, relPath); - const owner = possibleOwners.slice(-1)[0]; + const owner = possibleOwners[0]; if (!owner) { throw new Error(`${relPath} isn't owned by anyone in CODEOWNERS`);