fix: check for integrations.github without retrieving integrations

Support use without `integrations` or only integrations without frontend visible properties
(e.g., `bitbucketCloud`) being configured by checking `integrations.github` directly
without attempting to load `integrations`.

Previously, `integrations` was retrieved first and then the existence of the
key `github` was checked.

This could fail if there was no config below `integrations` which has `@visibility frontend`.

This happened if no integration or only non-Github integrations without
frontend visible properties like `integrations.bitbucketCloud` are used.

After this change, we will check `integrations.github` directly.

Closes: #11700
Signed-off-by: Patrick Jungermann <Patrick.Jungermann@gmail.com>
This commit is contained in:
Patrick Jungermann
2022-06-15 13:07:14 +02:00
parent 2bb51571de
commit 272106fdad
2 changed files with 6 additions and 2 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-catalog-import': patch
---
Support use without `integrations` or only integrations without frontend visible properties (e.g., `bitbucketCloud`) being configured by checking `integrations.github` directly without attempting to load `integrations`.
@@ -46,8 +46,7 @@ export const ImportInfoCard = (props: ImportInfoCardProps) => {
const appTitle = configApi.getOptional('app.title') || 'Backstage';
const catalogImportApi = useApi(catalogImportApiRef);
const integrations = configApi.getConfig('integrations');
const hasGithubIntegration = integrations.has('github');
const hasGithubIntegration = configApi.has('integrations.github');
const catalogFilename = useCatalogFilename();