chore: return undefined when entity is missing url location annotation
Signed-off-by: Adam Letizia <LetiziaAdam@JohnDeere.com>
This commit is contained in:
@@ -46,9 +46,7 @@ export class GithubActionsClient implements GithubActionsApi {
|
||||
const configs = readGithubIntegrationConfigs(
|
||||
this.configApi.getOptionalConfigArray('integrations.github') ?? [],
|
||||
);
|
||||
const githubIntegrationConfig = configs.find(
|
||||
v => v.host === hostname ?? 'github.com',
|
||||
);
|
||||
const githubIntegrationConfig = configs.find(v => v.host === hostname);
|
||||
const baseUrl = githubIntegrationConfig?.apiBaseUrl;
|
||||
return new Octokit({ auth: token, baseUrl });
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ export const getHostnameFromEntity = (entity: Entity) => {
|
||||
entity?.metadata.annotations?.[ANNOTATION_SOURCE_LOCATION] ??
|
||||
entity?.metadata.annotations?.[ANNOTATION_LOCATION];
|
||||
|
||||
return location && location.startsWith('url:')
|
||||
return location?.startsWith('url:')
|
||||
? gitUrlParse(location.slice(4)).resource
|
||||
: '';
|
||||
: undefined;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user