Skip to content

Commit

Permalink
fix(bitbucket): release notes heading link
Browse files Browse the repository at this point in the history
Signed-off-by: Adam Setch <[email protected]>
  • Loading branch information
setchy committed Nov 23, 2024
1 parent 9f889fb commit ee8f86b
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions lib/workers/repository/update/pr/changelog/release-notes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { detectPlatform } from '../../../../../util/common';
import { linkify } from '../../../../../util/markdown';
import { newlineRegex, regEx } from '../../../../../util/regex';
import { coerceString } from '../../../../../util/string';
import { isHttpUrl } from '../../../../../util/url';
import { isHttpUrl, joinUrlParts } from '../../../../../util/url';
import type { BranchUpgradeConfig } from '../../../../types';
import * as bitbucket from './bitbucket';
import * as gitea from './gitea';
Expand Down Expand Up @@ -359,7 +359,13 @@ export async function getReleaseNotesMd(
if (word.includes(version) && !isHttpUrl(word)) {
logger.trace({ body }, 'Found release notes for v' + version);
// TODO: fix url
const notesSourceUrl = `${baseUrl}${repository}/blob/HEAD/${changelogFile}`;
const notesSourceUrl = joinUrlParts(
baseUrl,
repository,
getSourceRootPath(baseUrl),
'HEAD',
changelogFile,
);
const mdHeadingLink = title
.filter((word) => !isHttpUrl(word))
.join('-')
Expand Down Expand Up @@ -479,3 +485,11 @@ export async function addReleaseNotes(
export function shouldSkipChangelogMd(repository: string): boolean {
return repositoriesToSkipMdFetching.includes(repository);
}

function getSourceRootPath(baseUrl: string): string {
if (baseUrl.startsWith('https://bitbucket.org/')) {
return 'src';
}

return 'blob';
}

0 comments on commit ee8f86b

Please sign in to comment.