diff --git a/lib/platform/index.spec.ts b/lib/platform/index.spec.ts index 1a29be4909fd66ede097adcbab888a0cbe3faeee..790180605afb674a502f64c2ef64ffc1a4755c46 100644 --- a/lib/platform/index.spec.ts +++ b/lib/platform/index.spec.ts @@ -60,6 +60,11 @@ describe('platform/index', () => { endpoint: 'https://api.bitbucket.org/', gitAuthor: 'user@domain.com', hostRules: [ + { + matchHost: 'api.bitbucket.org', + password: '123', + username: 'abc', + }, { hostType: 'bitbucket', matchHost: 'api.bitbucket.org', diff --git a/lib/platform/index.ts b/lib/platform/index.ts index 8780d11ecce4e8e45b87b31bbfd1bda815daa1c3..c99763c5279f9064e59145c7f7997bc613d1f9fb 100644 --- a/lib/platform/index.ts +++ b/lib/platform/index.ts @@ -56,7 +56,6 @@ export async function initPlatform(config: AllConfig): Promise<AllConfig> { // This is done for validation and will be overridden later once repo config is incorporated setGitAuthor(returnConfig.gitAuthor); const platformRule: HostRule = { - hostType: returnConfig.platform, matchHost: URL.parse(returnConfig.endpoint).hostname, }; ['token', 'username', 'password'].forEach((field) => { @@ -68,5 +67,11 @@ export async function initPlatform(config: AllConfig): Promise<AllConfig> { returnConfig.hostRules = returnConfig.hostRules || []; returnConfig.hostRules.push(platformRule); hostRules.add(platformRule); + const typedPlatformRule = { + ...platformRule, + hostType: returnConfig.platform, + }; + returnConfig.hostRules.push(typedPlatformRule); + hostRules.add(typedPlatformRule); return returnConfig; }