Skip to content

Commit

Permalink
fix(changelog): correct excactReleaseRegex (#22265)
Browse files Browse the repository at this point in the history
  • Loading branch information
ikesyo committed May 16, 2023
1 parent 63fa54c commit e1e5f7f
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
19 changes: 18 additions & 1 deletion lib/workers/repository/update/pr/changelog/github.spec.ts
Expand Up @@ -366,6 +366,10 @@ describe('workers/repository/update/pr/changelog/github', () => {
{ version: '1.0.1' },
{ version: 'correctPrefix/target@1.0.1' },
{ version: 'wrongPrefix/target-1.0.1' },
{ version: 'v1.0.2' },
{ version: '1.0.2' },
{ version: 'correctPrefix/target-1.0.2' },
{ version: 'wrongPrefix/target@1.0.2' },
])
);

Expand All @@ -376,9 +380,10 @@ describe('workers/repository/update/pr/changelog/github', () => {
endpoint: 'https://api.github.com/',
versioning: 'npm',
currentVersion: '1.0.0',
newVersion: '1.0.1',
newVersion: '1.0.2',
sourceUrl: 'https://github.com/chalk/chalk',
releases: [
{ version: '1.0.2', gitRef: '789012' },
{ version: '1.0.1', gitRef: '123456' },
{ version: '0.1.1', gitRef: 'npm_1.0.0' },
],
Expand All @@ -398,6 +403,18 @@ describe('workers/repository/update/pr/changelog/github', () => {
packageName: 'correctPrefix/target',
},
versions: [
{
version: '1.0.2',
date: undefined,
changes: [],
compare: {
url: 'https://github.com/chalk/chalk/compare/correctPrefix/target@1.0.1...correctPrefix/target-1.0.2',
},
releaseNotes: {
url: 'https://github.com/chalk/chalk/compare/correctPrefix/target@1.0.1...correctPrefix/target-1.0.2',
notesSourceUrl: '',
},
},
{
version: '1.0.1',
date: undefined,
Expand Down
Expand Up @@ -195,7 +195,7 @@ function findTagOfRelease(
tags: string[]
): string | undefined {
const regex = regEx(`(?:${packageName}|release)[@-]`, undefined, false);
const excactReleaseRegex = regEx(`${packageName}[@-_]v?${depNewVersion}`);
const excactReleaseRegex = regEx(`${packageName}[@\\-_]v?${depNewVersion}`);
const exactTagsList = tags.filter((tag) => {
return excactReleaseRegex.test(tag);
});
Expand Down

0 comments on commit e1e5f7f

Please sign in to comment.