Merge pull request #11664 from RoadieHQ/add-edit-url-to-github-teams
Add edit url to GitHub teams
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@backstage/plugin-catalog-backend-module-github': patch
|
||||
---
|
||||
|
||||
Adds an edit URL to the GitHub Teams Group entities.
|
||||
@@ -86,6 +86,7 @@ describe('github', () => {
|
||||
name: 'Team',
|
||||
description: 'The one and only team',
|
||||
avatarUrl: 'http://example.com/team.jpeg',
|
||||
editTeamUrl: 'http://example.com/orgs/blah/teams/team/edit',
|
||||
parentTeam: {
|
||||
slug: 'parent',
|
||||
combinedSlug: '',
|
||||
@@ -109,6 +110,11 @@ describe('github', () => {
|
||||
metadata: expect.objectContaining({
|
||||
name: 'team',
|
||||
description: 'The one and only team',
|
||||
annotations: {
|
||||
'github.com/team-slug': 'blah/team',
|
||||
'backstage.io/edit-url':
|
||||
'http://example.com/orgs/blah/teams/team/edit',
|
||||
},
|
||||
}),
|
||||
spec: {
|
||||
type: 'team',
|
||||
|
||||
@@ -52,6 +52,7 @@ export type Team = {
|
||||
name?: string;
|
||||
description?: string;
|
||||
avatarUrl?: string;
|
||||
editTeamUrl?: string;
|
||||
parentTeam?: Team;
|
||||
members: Connection<User>;
|
||||
};
|
||||
@@ -165,6 +166,7 @@ export async function getOrganizationTeams(
|
||||
name
|
||||
description
|
||||
avatarUrl
|
||||
editTeamUrl
|
||||
parentTeam { slug }
|
||||
members(first: 100, membership: IMMEDIATE) {
|
||||
pageInfo { hasNextPage }
|
||||
@@ -179,14 +181,20 @@ export async function getOrganizationTeams(
|
||||
const groupMemberUsers = new Map<string, string[]>();
|
||||
|
||||
const mapper = async (team: Team) => {
|
||||
const annotations: { [annotationName: string]: string } = {
|
||||
'github.com/team-slug': team.combinedSlug,
|
||||
};
|
||||
|
||||
if (team.editTeamUrl) {
|
||||
annotations['backstage.io/edit-url'] = team.editTeamUrl;
|
||||
}
|
||||
|
||||
const entity: GroupEntity = {
|
||||
apiVersion: 'backstage.io/v1alpha1',
|
||||
kind: 'Group',
|
||||
metadata: {
|
||||
name: team.slug,
|
||||
annotations: {
|
||||
'github.com/team-slug': team.combinedSlug,
|
||||
},
|
||||
annotations,
|
||||
},
|
||||
spec: {
|
||||
type: 'team',
|
||||
|
||||
Reference in New Issue
Block a user