Merge pull request #1181 from mikepenz/fix/1178

Respect `exclude_label` for `uncategorized` category definition
This commit is contained in:
Mike Penz
2023-07-28 12:33:18 +02:00
committed by GitHub
3 changed files with 36 additions and 3 deletions
Generated Vendored
+13
View File
@@ -627,10 +627,23 @@ function buildChangelog(diffInfo, origPrs, options) {
// we allow to have pull requests included in an "uncategorized" category // we allow to have pull requests included in an "uncategorized" category
for (const [category, pullRequests] of categorized) { for (const [category, pullRequests] of categorized) {
if ((category.labels === undefined || category.labels.length === 0) && category.rules === undefined) { if ((category.labels === undefined || category.labels.length === 0) && category.rules === undefined) {
// 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); 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; break;
} }
} }
// note the `exclude label` configuration of categories will not apply to the legacy "UNCATEGORIZED" placeholder
uncategorizedPrs.push(body); uncategorizedPrs.push(body);
} }
else { else {
Generated Vendored
+1 -1
View File
File diff suppressed because one or more lines are too long
+20
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 // we allow to have pull requests included in an "uncategorized" category
for (const [category, pullRequests] of categorized) { for (const [category, pullRequests] of categorized) {
if ((category.labels === undefined || category.labels.length === 0) && category.rules === undefined) { if ((category.labels === undefined || category.labels.length === 0) && category.rules === undefined) {
// 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) 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 break
} }
} }
// note the `exclude label` configuration of categories will not apply to the legacy "UNCATEGORIZED" placeholder
uncategorizedPrs.push(body) uncategorizedPrs.push(body)
} else { } else {
categorizedPrs.push(body) categorizedPrs.push(body)