diff --git a/.changeset/moody-carrots-shout.md b/.changeset/moody-carrots-shout.md new file mode 100644 index 0000000000..a1c357041f --- /dev/null +++ b/.changeset/moody-carrots-shout.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-catalog-backend-module-github': minor +--- + +Added `GitHubLocationAnalyzer`. This can be used to add to the `CatalogBuilder`. When added this will be used by `RepoLocationAnalyzer` to figure out if the given url that you are trying to import from the /catalog-import page already contains catalog-info.yaml files. diff --git a/plugins/catalog-backend-module-github/src/lib/github.ts b/plugins/catalog-backend-module-github/src/lib/github.ts index ec904a52e0..6a944af330 100644 --- a/plugins/catalog-backend-module-github/src/lib/github.ts +++ b/plugins/catalog-backend-module-github/src/lib/github.ts @@ -308,39 +308,6 @@ export async function getOrganizationRepositories( return { repositories }; } -export async function getRepository( - client: typeof graphql, - org: string, - name: string, -): Promise { - const query = ` - query repositories($org: String!, $name: String!) { - repository(name: $name, owner: $org) { - name - url - isArchived - repositoryTopics(first: 100) { - nodes { - ... on RepositoryTopic { - topic { - name - } - } - } - } - defaultBranchRef { - name - } - } - }`; - - const repository: Repository = await client(query, { - org, - name, - }); - return repository; -} - /** * Gets all the users out of a GitHub organization. * diff --git a/yarn.lock b/yarn.lock index 718736394b..a418c7e297 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4541,6 +4541,7 @@ __metadata: "@backstage/backend-plugin-api": "workspace:^" "@backstage/backend-tasks": "workspace:^" "@backstage/backend-test-utils": "workspace:^" + "@backstage/catalog-client": "workspace:^" "@backstage/catalog-model": "workspace:^" "@backstage/cli": "workspace:^" "@backstage/config": "workspace:^" @@ -4552,6 +4553,7 @@ __metadata: "@octokit/graphql": ^5.0.0 "@octokit/rest": ^19.0.4 "@types/lodash": ^4.14.151 + git-url-parse: ^13.1.0 lodash: ^4.17.21 msw: ^0.47.0 node-fetch: ^2.6.7 @@ -23512,7 +23514,7 @@ __metadata: languageName: node linkType: hard -"git-url-parse@npm:^13.0.0": +"git-url-parse@npm:^13.0.0, git-url-parse@npm:^13.1.0": version: 13.1.0 resolution: "git-url-parse@npm:13.1.0" dependencies: