- properly count categorized PRs
This commit is contained in:
+5
-1
@@ -1002,6 +1002,7 @@ function buildChangelog(prs, config, options) {
|
|||||||
for (const category of categories) {
|
for (const category of categories) {
|
||||||
categorized.set(category, []);
|
categorized.set(category, []);
|
||||||
}
|
}
|
||||||
|
const categorizedPrs = [];
|
||||||
const uncategorized = [];
|
const uncategorized = [];
|
||||||
// bring elements in order
|
// bring elements in order
|
||||||
for (const [pr, body] of transformedMap) {
|
for (const [pr, body] of transformedMap) {
|
||||||
@@ -1015,6 +1016,9 @@ function buildChangelog(prs, config, options) {
|
|||||||
if (!matched) {
|
if (!matched) {
|
||||||
uncategorized.push(body);
|
uncategorized.push(body);
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
categorizedPrs.push(body);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
core.info(`ℹ️ Ordered all pull requests into ${categories.length} categories`);
|
core.info(`ℹ️ Ordered all pull requests into ${categories.length} categories`);
|
||||||
// construct final changelog
|
// construct final changelog
|
||||||
@@ -1040,7 +1044,7 @@ function buildChangelog(prs, config, options) {
|
|||||||
transformedChangelog = transformedChangelog.replace('${{CHANGELOG}}', changelog);
|
transformedChangelog = transformedChangelog.replace('${{CHANGELOG}}', changelog);
|
||||||
transformedChangelog = transformedChangelog.replace('${{UNCATEGORIZED}}', changelogUncategorized);
|
transformedChangelog = transformedChangelog.replace('${{UNCATEGORIZED}}', changelogUncategorized);
|
||||||
// fill other placeholders
|
// 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 = transformedChangelog.replace('${{UNCATEGORIZED_COUNT}}', uncategorized.length.toString());
|
||||||
transformedChangelog = fillAdditionalPlaceholders(transformedChangelog, options);
|
transformedChangelog = fillAdditionalPlaceholders(transformedChangelog, options);
|
||||||
core.info(`ℹ️ Filled template`);
|
core.info(`ℹ️ Filled template`);
|
||||||
|
|||||||
+1
-1
File diff suppressed because one or more lines are too long
+4
-1
@@ -45,6 +45,7 @@ export function buildChangelog(
|
|||||||
for (const category of categories) {
|
for (const category of categories) {
|
||||||
categorized.set(category, [])
|
categorized.set(category, [])
|
||||||
}
|
}
|
||||||
|
const categorizedPrs: string[] = []
|
||||||
const uncategorized: string[] = []
|
const uncategorized: string[] = []
|
||||||
|
|
||||||
// bring elements in order
|
// bring elements in order
|
||||||
@@ -60,6 +61,8 @@ export function buildChangelog(
|
|||||||
|
|
||||||
if (!matched) {
|
if (!matched) {
|
||||||
uncategorized.push(body)
|
uncategorized.push(body)
|
||||||
|
} else {
|
||||||
|
categorizedPrs.push(body)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
core.info(`ℹ️ Ordered all pull requests into ${categories.length} categories`)
|
core.info(`ℹ️ Ordered all pull requests into ${categories.length} categories`)
|
||||||
@@ -102,7 +105,7 @@ export function buildChangelog(
|
|||||||
// fill other placeholders
|
// fill other placeholders
|
||||||
transformedChangelog = transformedChangelog.replace(
|
transformedChangelog = transformedChangelog.replace(
|
||||||
'${{CATEGORIZED_COUNT}}',
|
'${{CATEGORIZED_COUNT}}',
|
||||||
categorized.size.toString()
|
categorizedPrs.length.toString()
|
||||||
)
|
)
|
||||||
transformedChangelog = transformedChangelog.replace(
|
transformedChangelog = transformedChangelog.replace(
|
||||||
'${{UNCATEGORIZED_COUNT}}',
|
'${{UNCATEGORIZED_COUNT}}',
|
||||||
|
|||||||
Reference in New Issue
Block a user