Add categories to each changelog release (#10837)

Each changelog release now has category headers. The standard "keep a
changelog" [1] categories are used, along with the addition of
"Uncategorized" for any changes that have not yet been categorized.

The changelog script has been updated to add this "Uncategorized"
header if it isn't already present, and to place any new commits under
this header.

The changelog has been updated to property categorize each change in
recent releases, and to place changes in older releases under the
header "Uncategorized".

[1]: https://keepachangelog.com/en/1.0.0/
feature/default_network_editable
Mark Stacey 4 years ago committed by GitHub
parent 284c2cb481
commit 1c5dcd6efc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 555
      CHANGELOG.md
  2. 69
      development/auto-changelog.js

File diff suppressed because it is too large Load Diff

@ -69,6 +69,37 @@ async function main() {
const changelog = await fs.readFile(changelogFilename, { encoding: 'utf8' });
const changelogLines = changelog.split('\n');
const prNumbersWithChangelogEntries = [];
for (const line of changelogLines) {
const matchResults = line.match(/- \[#(\d+)\]/u);
if (matchResults === null) {
continue;
}
const prNumber = matchResults[1];
prNumbersWithChangelogEntries.push(prNumber);
}
const changelogEntries = [];
for (const { prNumber, description } of commitEntries) {
if (prNumbersWithChangelogEntries.includes(prNumber)) {
continue;
}
let changelogEntry;
if (prNumber) {
const prefix = `[#${prNumber}](${URL}/pull/${prNumber})`;
changelogEntry = `- ${prefix}: ${description}`;
} else {
changelogEntry = `- ${description}`;
}
changelogEntries.push(changelogEntry);
}
if (changelogEntries.length === 0) {
console.log('CHANGELOG required no updates');
return;
}
// remove the "v" prefix
const mostRecentVersion = mostRecentTag.slice(1);
@ -117,33 +148,21 @@ async function main() {
);
}
const prNumbersWithChangelogEntries = [];
for (const line of changelogLines) {
const matchResults = line.match(/- \[#(\d+)\]/u);
if (matchResults === null) {
continue;
}
const prNumber = matchResults[1];
prNumbersWithChangelogEntries.push(prNumber);
}
const changelogEntries = [];
for (const { prNumber, description } of commitEntries) {
if (prNumbersWithChangelogEntries.includes(prNumber)) {
continue;
}
let changelogEntry;
if (prNumber) {
const prefix = `[#${prNumber}](${URL}/pull/${prNumber})`;
changelogEntry = `- ${prefix}: ${description}`;
} else {
changelogEntry = `- ${description}`;
}
changelogEntries.push(changelogEntry);
// Ensure "Uncategorized" header is present
const uncategorizedHeaderIndex = releaseHeaderIndex + 1;
const uncategorizedHeader = '### Uncategorized';
if (changelogLines[uncategorizedHeaderIndex] !== '### Uncategorized') {
const hasEmptyLine = changelogLines[uncategorizedHeaderIndex] === '';
changelogLines.splice(
uncategorizedHeaderIndex,
0,
uncategorizedHeader,
// Ensure an empty line follows the new header
...(hasEmptyLine ? [] : ['']),
);
}
changelogLines.splice(releaseHeaderIndex + 1, 0, ...changelogEntries);
changelogLines.splice(uncategorizedHeaderIndex + 1, 0, ...changelogEntries);
const updatedChangelog = changelogLines.join('\n');
await fs.writeFile(changelogFilename, updatedChangelog);

Loading…
Cancel
Save