From 186604d350ff796868ea09ebf3686fd656d52804 Mon Sep 17 00:00:00 2001 From: Erik Larsson Date: Tue, 22 Dec 2020 22:50:45 +0100 Subject: [PATCH 1/3] Fix for 'integration.github.apiBaseUrl' configuration not properly overriding apiBaseUrl used by techdocs. --- packages/techdocs-common/src/default-branch.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/techdocs-common/src/default-branch.ts b/packages/techdocs-common/src/default-branch.ts index 1090fcb3d3..4b44010f0c 100644 --- a/packages/techdocs-common/src/default-branch.ts +++ b/packages/techdocs-common/src/default-branch.ts @@ -50,19 +50,19 @@ interface IGitlabBranch { } function getGithubApiUrl(config: Config, url: string): URL { - const { protocol, owner, name } = parseGitUrl(url); + const { resource, owner, name } = parseGitUrl(url); const providerConfigs = config.getOptionalConfigArray('integrations.github') ?? []; - // TODO: Maybe we need to filter by host in the array, not sure about GHE - const targetProviderConfig = providerConfigs[0]; + const hostConfig = providerConfigs.filter( + providerConfig => providerConfig.getOptionalString('host') === resource, + ); const apiBaseUrl = - targetProviderConfig?.getOptionalString('integrations.github.apiBaseUrl') ?? - 'api.github.com'; + hostConfig[0]?.getOptionalString('apiBaseUrl') ?? 'https://api.github.com'; const apiRepos = 'repos'; - return new URL(`${protocol}://${apiBaseUrl}/${apiRepos}/${owner}/${name}`); + return new URL(`${apiBaseUrl}/${apiRepos}/${owner}/${name}`); } function getGitlabApiUrl(url: string): URL { From f8ba88dedddf5a36c580cf3fa50fff9dcc172180 Mon Sep 17 00:00:00 2001 From: Erik Larsson Date: Tue, 22 Dec 2020 22:55:26 +0100 Subject: [PATCH 2/3] Add changeset --- .changeset/fifty-yaks-behave.md | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 .changeset/fifty-yaks-behave.md diff --git a/.changeset/fifty-yaks-behave.md b/.changeset/fifty-yaks-behave.md new file mode 100644 index 0000000000..31a9ffb0a9 --- /dev/null +++ b/.changeset/fifty-yaks-behave.md @@ -0,0 +1,6 @@ +--- +'example-app': patch +'@backstage/techdocs-common': patch +--- + +Fix for `integration.github.apiBaseUrl` configuration not properly overriding apiBaseUrl used by techdocs From 5f1314771388a165086f24edb6e8ac71b2f0ce04 Mon Sep 17 00:00:00 2001 From: Erik Larsson Date: Tue, 22 Dec 2020 23:34:24 +0100 Subject: [PATCH 3/3] Do not patch example-app --- .changeset/fifty-yaks-behave.md | 1 - 1 file changed, 1 deletion(-) diff --git a/.changeset/fifty-yaks-behave.md b/.changeset/fifty-yaks-behave.md index 31a9ffb0a9..8f2fa2ec67 100644 --- a/.changeset/fifty-yaks-behave.md +++ b/.changeset/fifty-yaks-behave.md @@ -1,5 +1,4 @@ --- -'example-app': patch '@backstage/techdocs-common': patch ---