- 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:
+12
@@ -1270,6 +1270,18 @@ function buildChangelog(prs, options) {
|
|||||||
}
|
}
|
||||||
let matched = false;
|
let matched = false;
|
||||||
for (const [category, pullRequests] of categorized) {
|
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 (category.exhaustive === true) {
|
||||||
if (haveEveryElements(category.labels.map(lbl => lbl.toLocaleLowerCase('en')), pr.labels)) {
|
if (haveEveryElements(category.labels.map(lbl => lbl.toLocaleLowerCase('en')), pr.labels)) {
|
||||||
pullRequests.push(body);
|
pullRequests.push(body);
|
||||||
|
|||||||
+1
-1
File diff suppressed because one or more lines are too long
@@ -19,6 +19,7 @@ export interface Configuration {
|
|||||||
export interface Category {
|
export interface Category {
|
||||||
title: string // the title of this category
|
title: string // the title of this category
|
||||||
labels: string[] // labels to associate PRs to 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
|
exhaustive?: boolean // requires all labels to be present in the PR
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -111,6 +111,26 @@ export function buildChangelog(
|
|||||||
|
|
||||||
let matched = false
|
let matched = false
|
||||||
for (const [category, pullRequests] of categorized) {
|
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 (category.exhaustive === true) {
|
||||||
if (
|
if (
|
||||||
haveEveryElements(
|
haveEveryElements(
|
||||||
|
|||||||
Reference in New Issue
Block a user