diff --git a/lib/util/common.spec.ts b/lib/util/common.spec.ts index a97ffef6ab5645d92c4f9180f25e439959ce79b3..b74ba87226564899d7fb9dc8d26b0d95e0498584 100644 --- a/lib/util/common.spec.ts +++ b/lib/util/common.spec.ts @@ -34,12 +34,19 @@ describe('util/common', () => { hostType: 'gitea', matchHost: 'gt.example.com', }); + hostRules.add({ + hostType: 'bitbucket', + matchHost: 'bb.example.com', + }); expect(detectPlatform('https://gl.example.com/chalk/chalk')).toBe( 'gitlab' ); expect(detectPlatform('https://gh.example.com/chalk/chalk')).toBe( 'github' ); + expect(detectPlatform('https://bb.example.com/chalk/chalk')).toBe( + 'bitbucket' + ); expect(detectPlatform('https://gt.example.com/chalk/chalk')).toBeNull(); }); }); diff --git a/lib/util/common.ts b/lib/util/common.ts index 783eba37a4c594308ee034e24dd11f33f48c1e75..381f850c461b3c98cc28f0fa671f63e7a5950d91 100644 --- a/lib/util/common.ts +++ b/lib/util/common.ts @@ -1,4 +1,5 @@ import { + BITBUCKET_API_USING_HOST_TYPES, GITHUB_API_USING_HOST_TYPES, GITLAB_API_USING_HOST_TYPES, } from '../constants'; @@ -34,6 +35,9 @@ export function detectPlatform( return null; } + if (BITBUCKET_API_USING_HOST_TYPES.includes(hostType)) { + return 'bitbucket'; + } if (GITLAB_API_USING_HOST_TYPES.includes(hostType)) { return 'gitlab'; }