diff --git a/lib/workers/repository/update/pr/changelog/source.spec.ts b/lib/workers/repository/update/pr/changelog/source.spec.ts
new file mode 100644
index 0000000000000000000000000000000000000000..d28aa4090d9d2c82da00dcd38b7ac2c72cc1934a
--- /dev/null
+++ b/lib/workers/repository/update/pr/changelog/source.spec.ts
@@ -0,0 +1,44 @@
+import { partial } from '../../../../../../test/util';
+import type { BranchConfig } from '../../../../types';
+import { GitHubChangeLogSource } from './github/source';
+
+const changelogSource = new GitHubChangeLogSource();
+const upgrade = partial<BranchConfig>({
+  endpoint: 'https://api.github.com/',
+  packageName: 'renovate',
+  sourceUrl: 'https://github.com/renovatebot/renovate',
+});
+
+describe('workers/repository/update/pr/changelog/source', () => {
+  describe('getBaseUrl', () => {
+    it('handles unsupported sourceUrl', () => {
+      expect(
+        changelogSource.getBaseUrl({
+          ...upgrade,
+          sourceUrl: undefined,
+        })
+      ).toBeEmptyString();
+    });
+
+    it('handles sourceUrl', () => {
+      expect(changelogSource.getBaseUrl(upgrade)).toBe('https://github.com/');
+    });
+  });
+
+  describe('getRepositoryFromUrl', () => {
+    it('handles unsupported sourceUrl', () => {
+      expect(
+        changelogSource.getRepositoryFromUrl({
+          ...upgrade,
+          sourceUrl: undefined,
+        })
+      ).toBeEmptyString();
+    });
+
+    it('handles sourceUrl', () => {
+      expect(changelogSource.getRepositoryFromUrl(upgrade)).toBe(
+        'renovatebot/renovate'
+      );
+    });
+  });
+});
diff --git a/lib/workers/repository/update/pr/changelog/source.ts b/lib/workers/repository/update/pr/changelog/source.ts
index 7a1498b18372094c7554fc6b5aaaf80282513ec5..6f746bd683aec7c33eb765971b1213e276c64494 100644
--- a/lib/workers/repository/update/pr/changelog/source.ts
+++ b/lib/workers/repository/update/pr/changelog/source.ts
@@ -1,4 +1,3 @@
-import URL from 'node:url';
 import is from '@sindresorhus/is';
 import { logger } from '../../../../../logger';
 import { getPkgReleases } from '../../../../../modules/datasource';
@@ -6,7 +5,7 @@ import type { Release } from '../../../../../modules/datasource/types';
 import * as allVersioning from '../../../../../modules/versioning';
 import * as packageCache from '../../../../../util/cache/package';
 import { regEx } from '../../../../../util/regex';
-import { trimSlashes } from '../../../../../util/url';
+import { parseUrl, trimSlashes } from '../../../../../util/url';
 import type { BranchUpgradeConfig } from '../../../../types';
 import { slugifyUrl } from './common';
 import { addReleaseNotes } from './release-notes';
@@ -238,16 +237,22 @@ export abstract class ChangeLogSource {
     return `${slugifyUrl(sourceUrl)}:${packageName}:${prev}:${next}`;
   }
 
-  protected getBaseUrl(config: BranchUpgradeConfig): string {
-    const parsedUrl = URL.parse(config.sourceUrl!);
-    const protocol = parsedUrl.protocol!;
-    const host = parsedUrl.host!;
+  getBaseUrl(config: BranchUpgradeConfig): string {
+    const parsedUrl = parseUrl(config.sourceUrl);
+    if (is.nullOrUndefined(parsedUrl)) {
+      return '';
+    }
+    const protocol = parsedUrl.protocol;
+    const host = parsedUrl.host;
     return `${protocol}//${host}/`;
   }
 
-  private getRepositoryFromUrl(config: BranchUpgradeConfig): string {
-    const parsedUrl = URL.parse(config.sourceUrl!);
-    const pathname = parsedUrl.pathname!;
+  getRepositoryFromUrl(config: BranchUpgradeConfig): string {
+    const parsedUrl = parseUrl(config.sourceUrl);
+    if (is.nullOrUndefined(parsedUrl)) {
+      return '';
+    }
+    const pathname = parsedUrl.pathname;
     return trimSlashes(pathname).replace(regEx(/\.git$/), '');
   }