Skip to content

Commit

Permalink
use node:path instead
Browse files Browse the repository at this point in the history
Signed-off-by: Adam Setch <adam.setch@outlook.com>
  • Loading branch information
setchy committed Nov 24, 2024
1 parent 96193d0 commit 07c88f5
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions lib/workers/repository/update/pr/changelog/bitbucket/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import path from 'node:path';
import is from '@sindresorhus/is';
import changelogFilenameRegex from 'changelog-filename-regex';
import { logger } from '../../../../../../logger';
Expand Down Expand Up @@ -44,15 +45,12 @@ export async function getReleaseNotesMd(
const allFiles = rootFiles.filter((f) => f.type === 'commit_file');

const files = allFiles.filter((f) =>
changelogFilenameRegex.test(getFilenameFromPath(f.path)),
changelogFilenameRegex.test(path.basename(f.path)),
);

const changelogFile = files
.sort((a, b) =>
compareChangelogFilePath(
getFilenameFromPath(a.path),
getFilenameFromPath(b.path),
),
compareChangelogFilePath(path.basename(a.path), path.basename(b.path)),
)
.shift();
if (is.nullOrUndefined(changelogFile)) {
Expand Down Expand Up @@ -81,10 +79,6 @@ export async function getReleaseNotesMd(
return { changelogFile: changelogFile.path, changelogMd };
}

function getFilenameFromPath(filePath: string): string {
return filePath.split('/').pop()!;
}

export function getReleaseList(
_project: ChangeLogProject,
_release: ChangeLogRelease,
Expand Down

0 comments on commit 07c88f5

Please sign in to comment.