mirror of
https://github.com/nodejs/node.git
synced 2025-04-28 05:25:19 +00:00
tools: add semver-major release support to release-lint
Co-authored-by: RafaelGSS <rafael.nunu@hotmail.com> Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com> PR-URL: https://github.com/nodejs/node/pull/57892 Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com> Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
This commit is contained in:
parent
e773e09c3f
commit
99dc2d376a
@ -19,14 +19,24 @@ const stdinLineByLine = createInterface(process.stdin)[Symbol.asyncIterator]();
|
||||
|
||||
const changelog = await readFile(CHANGELOG_PATH, 'utf-8');
|
||||
const commitListingStart = changelog.indexOf('\n### Commits\n');
|
||||
const commitListingEnd = changelog.indexOf('\n\n<a', commitListingStart);
|
||||
const commitList = changelog.slice(commitListingStart, commitListingEnd === -1 ? undefined : commitListingEnd + 1)
|
||||
// Checking for semverness is too expansive, it is left as a exercice for human reviewers.
|
||||
let commitList;
|
||||
if (commitListingStart === -1) {
|
||||
// We're preparing a semver-major release.
|
||||
commitList = changelog.replace(/(^.+\n### Semver-Major|\n### Semver-(Minor|Patch)) Commits\n/gs, '')
|
||||
.replaceAll('**(SEMVER-MAJOR)** ', '');
|
||||
} else {
|
||||
const commitListingEnd = changelog.indexOf('\n\n<a', commitListingStart);
|
||||
assert.notStrictEqual(commitListingEnd, -1);
|
||||
commitList = changelog.slice(commitListingStart, commitListingEnd + 1);
|
||||
}
|
||||
|
||||
// Normalize for consistent comparison
|
||||
commitList = commitList
|
||||
.replaceAll('**(SEMVER-MINOR)** ', '')
|
||||
// Correct Markdown escaping is validated by the linter, getting rid of it here helps.
|
||||
.replaceAll('\\', '');
|
||||
|
||||
let expectedNumberOfCommitsLeft = commitList.match(/\n\* \[/g).length;
|
||||
let expectedNumberOfCommitsLeft = commitList.match(/\n\* \[/g)?.length ?? 0;
|
||||
|
||||
for await (const line of stdinLineByLine) {
|
||||
const { smallSha, title, prURL } = JSON.parse(line);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user