diff --git a/plugins/github-deployments/README.md b/plugins/github-deployments/README.md index 8658eb5985..46d54cac57 100644 --- a/plugins/github-deployments/README.md +++ b/plugins/github-deployments/README.md @@ -23,16 +23,7 @@ export AUTH_CLIENT_SECRET={{YOUR_CLIENT_SECRET}} yarn add @backstage/plugin-github-deployments ``` -3. If you use GitHub enterprise then set the host in `app-config.yaml`. - -```yaml -# app-config.yaml -integrations: - github: - - host: { { YOUR_GITHUB_HOST_URL } } -``` - -4. Add the plugin to the app +3. Add the plugin to the app ```typescript // packages/app/src/plugins.ts @@ -40,7 +31,7 @@ integrations: export { plugin as GithubDeployments } from '@backstage/plugin-github-deployments'; ``` -5. Add the `EntityGithubDeploymentsCard` to the EntityPage: +4. Add the `EntityGithubDeploymentsCard` to the EntityPage: ```typescript // packages/app/src/components/catalog/EntityPage.tsx @@ -58,7 +49,7 @@ const OverviewContent = () => ( ); ``` -6. Add the `github.com/project-slug` annotation to your `catalog-info.yaml` file: +5. Add the `github.com/project-slug` annotation to your `catalog-info.yaml` file: ```yaml apiVersion: backstage.io/v1alpha1 diff --git a/plugins/github-deployments/src/api/index.ts b/plugins/github-deployments/src/api/index.ts index 32b7f19a29..ca69ac3853 100644 --- a/plugins/github-deployments/src/api/index.ts +++ b/plugins/github-deployments/src/api/index.ts @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import { ConfigApi, createApiRef, OAuthApi } from '@backstage/core'; +import { createApiRef, OAuthApi } from '@backstage/core'; import { graphql } from '@octokit/graphql'; export type GithubDeployment = { @@ -40,7 +40,6 @@ export const githubDeploymentsApiRef = createApiRef({ }); export type Options = { - configApi: ConfigApi; githubAuthApi: OAuthApi; }; @@ -71,31 +70,20 @@ export type QueryResponse = { }; export class GithubDeploymentsApiClient implements GithubDeploymentsApi { - private readonly configApi: ConfigApi; private readonly githubAuthApi: OAuthApi; constructor(options: Options) { - this.configApi = options.configApi; this.githubAuthApi = options.githubAuthApi; } - private getBaseUrl() { - const providerConfigs = - this.configApi.getOptionalConfigArray('integrations.github') ?? []; - const targetProviderConfig = providerConfigs[0]; - return targetProviderConfig?.getOptionalString('apiBaseUrl'); - } - async listDeployments(options: { owner: string; repo: string; last: number; }): Promise { const token = await this.githubAuthApi.getAccessToken(['repo']); - const baseUrl = this.getBaseUrl() || 'https://api.github.com'; const graphQLWithAuth = graphql.defaults({ - baseUrl, headers: { authorization: `token ${token}`, }, diff --git a/plugins/github-deployments/src/components/GithubDeploymentsCard.test.tsx b/plugins/github-deployments/src/components/GithubDeploymentsCard.test.tsx index fa13e12cd2..962c08d1cd 100644 --- a/plugins/github-deployments/src/components/GithubDeploymentsCard.test.tsx +++ b/plugins/github-deployments/src/components/GithubDeploymentsCard.test.tsx @@ -50,10 +50,7 @@ const githubAuthApi: OAuthApi = { const apis = ApiRegistry.from([ [configApiRef, configApi], [errorApiRef, errorApiMock], - [ - githubDeploymentsApiRef, - new GithubDeploymentsApiClient({ configApi, githubAuthApi }), - ], + [githubDeploymentsApiRef, new GithubDeploymentsApiClient({ githubAuthApi })], ]); describe('github-deployments', () => { diff --git a/plugins/github-deployments/src/plugin.ts b/plugins/github-deployments/src/plugin.ts index 438f2f70d2..3707b1cf68 100644 --- a/plugins/github-deployments/src/plugin.ts +++ b/plugins/github-deployments/src/plugin.ts @@ -14,7 +14,6 @@ * limitations under the License. */ import { - configApiRef, createApiFactory, createComponentExtension, createPlugin, @@ -27,9 +26,9 @@ export const githubDeploymentsPlugin = createPlugin({ apis: [ createApiFactory({ api: githubDeploymentsApiRef, - deps: { configApi: configApiRef, githubAuthApi: githubAuthApiRef }, - factory: ({ configApi, githubAuthApi }) => - new GithubDeploymentsApiClient({ configApi, githubAuthApi }), + deps: { githubAuthApi: githubAuthApiRef }, + factory: ({ githubAuthApi }) => + new GithubDeploymentsApiClient({ githubAuthApi }), }), ], });