Skip to content

Commit 43b58aa

Browse files
committed
fix: missing changelog for uppercase version titles
If projects use title case in their CHANGELOG.md version, the title will look like "Vx.y.z".
1 parent 469c2a3 commit 43b58aa

File tree

2 files changed

+29
-1
lines changed

2 files changed

+29
-1
lines changed

lib/workers/repository/update/pr/changelog/release-notes.spec.ts

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1612,6 +1612,34 @@ describe('workers/repository/update/pr/changelog/release-notes', () => {
16121612
expect(res).toBeNull();
16131613
});
16141614

1615+
it('parses uppercase version title V1.2.3 when version is v1.2.3', async () => {
1616+
const changelogMd = '## V1.2.3\n\nSome release notes';
1617+
httpMock
1618+
.scope('https://api.github.com')
1619+
.get('/repos/some/repo')
1620+
.reply(200)
1621+
.get('/repos/some/repo/git/trees/HEAD')
1622+
.reply(200, githubTreeResponse)
1623+
.get('/repos/some/repo/git/blobs/abcd')
1624+
.reply(200, {
1625+
content: toBase64(changelogMd),
1626+
});
1627+
1628+
const res = await getReleaseNotesMd(
1629+
{
1630+
...githubProject,
1631+
repository: 'some/repo',
1632+
},
1633+
partial<ChangeLogRelease>({
1634+
version: 'v1.2.3',
1635+
gitRef: 'v1.2.3',
1636+
}),
1637+
);
1638+
1639+
expect(res).not.toBeNull();
1640+
expect(res?.body).toContain('Some release notes');
1641+
});
1642+
16151643
it('isUrl', () => {
16161644
expect(versionOneNotes).not.toMatchObject(versionTwoNotes);
16171645
});

lib/workers/repository/update/pr/changelog/release-notes.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,7 @@ export async function getReleaseNotesMd(
396396
const url = `${notesSourceUrl}#${mdHeadingLink}`;
397397
// Look for version in title
398398
for (const word of title) {
399-
if (word.includes(version) && !isHttpUrl(word)) {
399+
if (word.toLowerCase().includes(version) && !isHttpUrl(word)) {
400400
logger.trace({ body }, 'Found release notes for v' + version);
401401
return {
402402
body: await linkifyBody(project, body),

0 commit comments

Comments
 (0)