From 5de7eee2b3f7011397ea273d1289933c343da9cb Mon Sep 17 00:00:00 2001 From: RahulGautamSingh Date: Thu, 9 May 2024 10:36:59 +0545 Subject: [PATCH] refactor: use `detectPlatform` (#28945) --- .../repository/update/pr/changelog/github/source.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/workers/repository/update/pr/changelog/github/source.ts b/lib/workers/repository/update/pr/changelog/github/source.ts index c8909dad98fcec..496b5547f60460 100644 --- a/lib/workers/repository/update/pr/changelog/github/source.ts +++ b/lib/workers/repository/update/pr/changelog/github/source.ts @@ -1,6 +1,6 @@ -import URL from 'node:url'; import { GlobalConfig } from '../../../../../../config/global'; import { logger } from '../../../../../../logger'; +import { detectPlatform } from '../../../../../../util/common'; import * as hostRules from '../../../../../../util/host-rules'; import type { BranchUpgradeConfig } from '../../../../../types'; import { ChangeLogSource } from '../source'; @@ -42,8 +42,7 @@ export class GitHubChangeLogSource extends ChangeLogSource { error?: ChangeLogError; } { const sourceUrl = config.sourceUrl!; - const parsedUrl = URL.parse(sourceUrl); - const host = parsedUrl.host; + const host = detectPlatform(sourceUrl); const manager = config.manager; const packageName = config.packageName; @@ -57,7 +56,7 @@ export class GitHubChangeLogSource extends ChangeLogSource { }); // istanbul ignore if if (host && !token) { - if (host.endsWith('.github.com') || host === 'github.com') { + if (host === 'github') { if (!GlobalConfig.get('githubTokenWarn')) { logger.debug( { manager, packageName, sourceUrl },