- respect the exclude label for the uncategorized cateogry

- FIX https://github.com/mikepenz/release-changelog-builder-action/issues/1178
This commit is contained in:
Mike Penz
2023-07-28 10:22:16 +00:00
committed by GitHub
parent 39e5c22e1c
commit a474b82119
3 changed files with 36 additions and 3 deletions
Generated Vendored
+14 -1
View File
@@ -627,10 +627,23 @@ function buildChangelog(diffInfo, origPrs, options) {
// we allow to have pull requests included in an "uncategorized" category
for (const [category, pullRequests] of categorized) {
if ((category.labels === undefined || category.labels.length === 0) && category.rules === undefined) {
pullRequests.push(body);
// check if any exclude label matches for the "uncategorized" category
if (category.exclude_labels !== undefined) {
if (!(0, utils_1.haveCommonElementsArr)(category.exclude_labels.map(lbl => lbl.toLocaleLowerCase('en')), pr.labels)) {
pullRequests.push(body);
}
else if (core.isDebug()) {
const excludeLabels = JSON.stringify(category.exclude_labels);
core.debug(` PR ${pr.number} with labels: ${pr.labels} excluded from uncategorized category via exclude label: ${excludeLabels}`);
}
}
else {
pullRequests.push(body);
}
break;
}
}
// note the `exclude label` configuration of categories will not apply to the legacy "UNCATEGORIZED" placeholder
uncategorizedPrs.push(body);
}
else {
Generated Vendored
+1 -1
View File
File diff suppressed because one or more lines are too long
+21 -1
View File
@@ -228,10 +228,30 @@ export function buildChangelog(diffInfo: DiffInfo, origPrs: PullRequestInfo[], o
// we allow to have pull requests included in an "uncategorized" category
for (const [category, pullRequests] of categorized) {
if ((category.labels === undefined || category.labels.length === 0) && category.rules === undefined) {
pullRequests.push(body)
// check if any exclude label matches for the "uncategorized" category
if (category.exclude_labels !== undefined) {
if (
!haveCommonElementsArr(
category.exclude_labels.map(lbl => lbl.toLocaleLowerCase('en')),
pr.labels
)
) {
pullRequests.push(body)
} else if (core.isDebug()) {
const excludeLabels = JSON.stringify(category.exclude_labels)
core.debug(
` PR ${pr.number} with labels: ${pr.labels} excluded from uncategorized category via exclude label: ${excludeLabels}`
)
}
} else {
pullRequests.push(body)
}
break
}
}
// note the `exclude label` configuration of categories will not apply to the legacy "UNCATEGORIZED" placeholder
uncategorizedPrs.push(body)
} else {
categorizedPrs.push(body)