- add new ability to define exclude_labels for categories (give greater flexibility)

- FIX https://github.com/mikepenz/release-changelog-builder-action/issues/681
This commit is contained in:
Mike Penz
2022-02-11 11:12:39 +01:00
parent 0b69e37c22
commit a0a47047d6
4 changed files with 34 additions and 1 deletions
Generated Vendored
+12
View File
@@ -1270,6 +1270,18 @@ function buildChangelog(prs, options) {
}
let matched = false;
for (const [category, pullRequests] of categorized) {
// check if any exclude label matches
if (category.exclude_labels !== undefined) {
if (haveCommonElements(category.exclude_labels.map(lbl => lbl.toLocaleLowerCase('en')), pr.labels)) {
if (core.isDebug()) {
const prNum = pr.number;
const prLabels = pr.labels;
const excludeLabels = JSON.stringify(category.exclude_labels);
core.debug(`PR ${prNum} with labels: ${prLabels} excluded from category via exclude label: ${excludeLabels}`);
}
continue; // one of the exclude labels matched, skip the PR for this category
}
}
if (category.exhaustive === true) {
if (haveEveryElements(category.labels.map(lbl => lbl.toLocaleLowerCase('en')), pr.labels)) {
pullRequests.push(body);
Generated Vendored
+1 -1
View File
File diff suppressed because one or more lines are too long
+1
View File
@@ -19,6 +19,7 @@ export interface Configuration {
export interface Category {
title: string // the title of this category
labels: string[] // labels to associate PRs to this category
exclude_labels?: string[] // if an exclude label is detected, the PR will be excluded from this category
exhaustive?: boolean // requires all labels to be present in the PR
}
+20
View File
@@ -111,6 +111,26 @@ export function buildChangelog(
let matched = false
for (const [category, pullRequests] of categorized) {
// check if any exclude label matches
if (category.exclude_labels !== undefined) {
if (
haveCommonElements(
category.exclude_labels.map(lbl => lbl.toLocaleLowerCase('en')),
pr.labels
)
) {
if (core.isDebug()) {
const prNum = pr.number
const prLabels = pr.labels
const excludeLabels = JSON.stringify(category.exclude_labels)
core.debug(
`PR ${prNum} with labels: ${prLabels} excluded from category via exclude label: ${excludeLabels}`
)
}
continue // one of the exclude labels matched, skip the PR for this category
}
}
if (category.exhaustive === true) {
if (
haveEveryElements(