- properly count categorized PRs

This commit is contained in:
Mike Penz
2020-10-19 18:03:50 +02:00
parent 4eaa60b4d5
commit 26cab8c692
3 changed files with 10 additions and 3 deletions
Generated Vendored
+5 -1
View File
@@ -1002,6 +1002,7 @@ function buildChangelog(prs, config, options) {
for (const category of categories) {
categorized.set(category, []);
}
const categorizedPrs = [];
const uncategorized = [];
// bring elements in order
for (const [pr, body] of transformedMap) {
@@ -1015,6 +1016,9 @@ function buildChangelog(prs, config, options) {
if (!matched) {
uncategorized.push(body);
}
else {
categorizedPrs.push(body);
}
}
core.info(`️ Ordered all pull requests into ${categories.length} categories`);
// construct final changelog
@@ -1040,7 +1044,7 @@ function buildChangelog(prs, config, options) {
transformedChangelog = transformedChangelog.replace('${{CHANGELOG}}', changelog);
transformedChangelog = transformedChangelog.replace('${{UNCATEGORIZED}}', changelogUncategorized);
// fill other placeholders
transformedChangelog = transformedChangelog.replace('${{CATEGORIZED_COUNT}}', categorized.size.toString());
transformedChangelog = transformedChangelog.replace('${{CATEGORIZED_COUNT}}', categorizedPrs.length.toString());
transformedChangelog = transformedChangelog.replace('${{UNCATEGORIZED_COUNT}}', uncategorized.length.toString());
transformedChangelog = fillAdditionalPlaceholders(transformedChangelog, options);
core.info(`️ Filled template`);
Generated Vendored
+1 -1
View File
File diff suppressed because one or more lines are too long
+4 -1
View File
@@ -45,6 +45,7 @@ export function buildChangelog(
for (const category of categories) {
categorized.set(category, [])
}
const categorizedPrs: string[] = []
const uncategorized: string[] = []
// bring elements in order
@@ -60,6 +61,8 @@ export function buildChangelog(
if (!matched) {
uncategorized.push(body)
} else {
categorizedPrs.push(body)
}
}
core.info(`️ Ordered all pull requests into ${categories.length} categories`)
@@ -102,7 +105,7 @@ export function buildChangelog(
// fill other placeholders
transformedChangelog = transformedChangelog.replace(
'${{CATEGORIZED_COUNT}}',
categorized.size.toString()
categorizedPrs.length.toString()
)
transformedChangelog = transformedChangelog.replace(
'${{UNCATEGORIZED_COUNT}}',