Skip to content

Commit 3a450a6

Browse files
committed
update changelog
1 parent eeff1fa commit 3a450a6

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/generate-changelog.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import shell from 'shelljs'
33

44
// Regexes to find the changelog contents within a PR.
55
const FIXES_REGEX = /^CHANGELOG-FIXES:(.*)/gm
6-
const ADDS_REGEX = /^CHANGELOG-ADDS:(.*)/gm
6+
const NEW_REGEX = /^CHANGELOG-NEW:(.*)/gm
77

88
export interface Changelog {
99
added: string[] | undefined
@@ -48,8 +48,9 @@ export async function generateChangelog(
4848
)
4949
) {
5050
// Check for a release where `release.version` is less then `currentVersion`, which means `localCompare` would return `1`.
51+
// This is by no means a perfect check, but should suffice because each version is of the exact same format and length.
5152
if (
52-
currentVersion.localeCompare(release.version, undefined, {
53+
currentVersion.localeCompare(release.version, undefined /* locales */, {
5354
numeric: true,
5455
sensitivity: 'base'
5556
}) === 1
@@ -65,6 +66,7 @@ export async function generateChangelog(
6566
const currentBranch = branchFromVersion(currentVersion, channel)
6667
const previousBranch = branchFromVersion(lastReleaseVersion, channel)
6768

69+
// Find all the commits that are in `currentBranch` but not `previousBranch`.
6870
const command = shell.exec(
6971
`git --no-pager log ^${previousBranch} ${currentBranch} --pretty=format:%H`,
7072
{silent: true}
@@ -83,6 +85,8 @@ export async function generateChangelog(
8385
}
8486
}
8587

88+
// Returns the release branch from a version tag. A version like `v0.2022.04.11.09.09.stable_01` would
89+
// be converted to `stable_release/v0.2022.04.11.09.09.stable`.
8690
function branchFromVersion(version: string, channel: string): string {
8791
return `origin/${channel}_release/${version.substring(
8892
0,
@@ -177,7 +181,7 @@ function parseChangelogFromPrDescriptions(prDescriptions: string[]): Changelog {
177181
}
178182
}
179183

180-
const addMatches = prDescription.matchAll(ADDS_REGEX)
184+
const addMatches = prDescription.matchAll(NEW_REGEX)
181185
if (addMatches) {
182186
const addMatchesArray = [...addMatches]
183187
for (const addMatch of addMatchesArray) {

0 commit comments

Comments
 (0)