- ensure to detect if a PR was matched once (e.g. it's not not categorized)

This commit is contained in:
Mike Penz
2023-01-06 10:04:01 +00:00
committed by GitHub
parent d4ccbe1734
commit 981b531f21
3 changed files with 9 additions and 5 deletions
Generated Vendored
+4 -2
View File
@@ -1790,8 +1790,9 @@ function buildChangelog(diffInfo, prs, options) {
if (pr.status === 'open') { if (pr.status === 'open') {
openPrs.push(body); openPrs.push(body);
} }
let matched = false; let matchedOnce = false; // in case we matched once at least, the PR can't be uncategorized
for (const [category, pullRequests] of categorized) { for (const [category, pullRequests] of categorized) {
let matched = false; // check if we matched within the given category
// check if any exclude label matches // check if any exclude label matches
if (category.exclude_labels !== undefined) { if (category.exclude_labels !== undefined) {
if ((0, utils_1.haveCommonElements)(category.exclude_labels.map(lbl => lbl.toLocaleLowerCase('en')), pr.labels)) { if ((0, utils_1.haveCommonElements)(category.exclude_labels.map(lbl => lbl.toLocaleLowerCase('en')), pr.labels)) {
@@ -1828,8 +1829,9 @@ function buildChangelog(diffInfo, prs, options) {
if (matched) { if (matched) {
pullRequests.push(body); // if matched add the PR to the list pullRequests.push(body); // if matched add the PR to the list
} }
matchedOnce = matchedOnce || matched;
} }
if (!matched) { if (!matchedOnce) {
// 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) {
Generated Vendored
+1 -1
View File
File diff suppressed because one or more lines are too long
+4 -2
View File
@@ -101,8 +101,9 @@ export function buildChangelog(diffInfo: DiffInfo, prs: PullRequestInfo[], optio
openPrs.push(body) openPrs.push(body)
} }
let matched = false let matchedOnce = false // in case we matched once at least, the PR can't be uncategorized
for (const [category, pullRequests] of categorized) { for (const [category, pullRequests] of categorized) {
let matched = false // check if we matched within the given category
// check if any exclude label matches // check if any exclude label matches
if (category.exclude_labels !== undefined) { if (category.exclude_labels !== undefined) {
if ( if (
@@ -150,9 +151,10 @@ export function buildChangelog(diffInfo: DiffInfo, prs: PullRequestInfo[], optio
if (matched) { if (matched) {
pullRequests.push(body) // if matched add the PR to the list pullRequests.push(body) // if matched add the PR to the list
} }
matchedOnce = matchedOnce || matched
} }
if (!matched) { if (!matchedOnce) {
// 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) {