diff --git a/lib/workers/repository/update/pr/changelog/index.ts b/lib/workers/repository/update/pr/changelog/index.ts index 42270eb4695d3d6356213b5b4e803634489f3eea..7af3284a056312fe84df8fb1cd7f1ca69c74e50e 100644 --- a/lib/workers/repository/update/pr/changelog/index.ts +++ b/lib/workers/repository/update/pr/changelog/index.ts @@ -26,23 +26,29 @@ export async function getChangeLogJSON( `Fetching changelog: ${sourceUrl} (${currentVersion} -> ${newVersion})` ); + let res: ChangeLogResult | null = null; + const platform = detectPlatform(sourceUrl); - if (platform === 'github') { - return await sourceGithub.getChangeLogJSON(config); - } + switch (platform) { + case 'gitlab': + res = await sourceGitlab.getChangeLogJSON(config); + break; + case 'github': + res = await sourceGithub.getChangeLogJSON(config); + break; - if (platform === 'gitlab') { - return await sourceGitlab.getChangeLogJSON(config); + default: + logger.info( + { sourceUrl, hostType: platform }, + 'Unknown platform, skipping changelog fetching.' + ); + break; } - logger.info( - { sourceUrl, hostType: platform }, - 'Unknown platform, skipping changelog fetching.' - ); + return res; } catch (err) /* istanbul ignore next */ { logger.error({ config, err }, 'getChangeLogJSON error'); + return null; } - - return null; }