From bd101cefd3763ca952a05ce32e5de69ad966272c Mon Sep 17 00:00:00 2001 From: danyelleac Date: Thu, 4 May 2023 16:48:40 -0300 Subject: [PATCH 1/3] github-org-edited-team-description Signed-off-by: danyelleac --- .changeset/wet-dolphins-love.md | 5 +++++ .../src/providers/GithubOrgEntityProvider.test.ts | 1 + .../src/providers/GithubOrgEntityProvider.ts | 9 ++++++++- 3 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 .changeset/wet-dolphins-love.md diff --git a/.changeset/wet-dolphins-love.md b/.changeset/wet-dolphins-love.md new file mode 100644 index 0000000000..1b22821f81 --- /dev/null +++ b/.changeset/wet-dolphins-love.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-catalog-backend-module-github': major +--- + +Adding description in function 'onTeamEditedInOrganization` in event of team.edited diff --git a/plugins/catalog-backend-module-github/src/providers/GithubOrgEntityProvider.test.ts b/plugins/catalog-backend-module-github/src/providers/GithubOrgEntityProvider.test.ts index ff42e42718..77f0a050c1 100644 --- a/plugins/catalog-backend-module-github/src/providers/GithubOrgEntityProvider.test.ts +++ b/plugins/catalog-backend-module-github/src/providers/GithubOrgEntityProvider.test.ts @@ -834,6 +834,7 @@ describe('GithubOrgEntityProvider', () => { }, name: 'mygroup-with-spaces', }, + description: 'description-from-the-new-team', apiVersion: 'backstage.io/v1alpha1', kind: 'Group', spec: { diff --git a/plugins/catalog-backend-module-github/src/providers/GithubOrgEntityProvider.ts b/plugins/catalog-backend-module-github/src/providers/GithubOrgEntityProvider.ts index 02e225c938..c181510a67 100644 --- a/plugins/catalog-backend-module-github/src/providers/GithubOrgEntityProvider.ts +++ b/plugins/catalog-backend-module-github/src/providers/GithubOrgEntityProvider.ts @@ -371,14 +371,21 @@ export class GithubOrgEntityProvider assignGroupsToUsers(usersToRebuild, groups); buildOrgHierarchy(groups); - const oldName = event.changes.name?.from || ''; + const oldName = event.changes.name?.from || event.team.name; const oldSlug = oldName.toLowerCase().replaceAll(/\s/gi, '-'); + const oldDescription = + event.changes.description?.from || event.team.description; + const oldDescriptionSlug = oldDescription + ?.toLowerCase() + .replaceAll(/\s/gi, '-'); + const { removed } = createDeltaOperation(org, [ { ...group, metadata: { name: oldSlug, + description: oldDescriptionSlug, }, }, ]); From 6028b54ebf101caa7db08146dd3605b3408823f9 Mon Sep 17 00:00:00 2001 From: danyelleac Date: Thu, 4 May 2023 17:10:01 -0300 Subject: [PATCH 2/3] test-github-org-edited-team-description Signed-off-by: danyelleac --- .../src/providers/GithubOrgEntityProvider.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/catalog-backend-module-github/src/providers/GithubOrgEntityProvider.test.ts b/plugins/catalog-backend-module-github/src/providers/GithubOrgEntityProvider.test.ts index 77f0a050c1..3e58c1473f 100644 --- a/plugins/catalog-backend-module-github/src/providers/GithubOrgEntityProvider.test.ts +++ b/plugins/catalog-backend-module-github/src/providers/GithubOrgEntityProvider.test.ts @@ -833,8 +833,8 @@ describe('GithubOrgEntityProvider', () => { 'url:https://github.com/orgs/backstage/teams/mygroup-with-spaces', }, name: 'mygroup-with-spaces', + description: 'description-from-the-new-team', }, - description: 'description-from-the-new-team', apiVersion: 'backstage.io/v1alpha1', kind: 'Group', spec: { From 1f802f03ad509d80b342041ca2a67b0d557c5c97 Mon Sep 17 00:00:00 2001 From: Danyelle Amarante <90638175+Danyelleac@users.noreply.github.com> Date: Mon, 8 May 2023 09:19:54 -0300 Subject: [PATCH 3/3] Update .changeset/wet-dolphins-love.md Co-authored-by: Johan Haals Signed-off-by: Danyelle Amarante <90638175+Danyelleac@users.noreply.github.com> --- .changeset/wet-dolphins-love.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.changeset/wet-dolphins-love.md b/.changeset/wet-dolphins-love.md index 1b22821f81..3aa7f776a7 100644 --- a/.changeset/wet-dolphins-love.md +++ b/.changeset/wet-dolphins-love.md @@ -2,4 +2,4 @@ '@backstage/plugin-catalog-backend-module-github': major --- -Adding description in function 'onTeamEditedInOrganization` in event of team.edited +Updated the `team.edited` event emitted from `GithubOrgEntityProvider` to also include teams description.