- introduce new configuration option to define category labels to be exhaustive
- require all labels of a category to be present in the matching PR - update to typescript 4.4.x - recompile dist
This commit is contained in:
+24
-8
@@ -103,14 +103,26 @@ export function buildChangelog(
|
||||
|
||||
let matched = false
|
||||
for (const [category, pullRequests] of categorized) {
|
||||
if (
|
||||
haveCommonElements(
|
||||
category.labels.map(lbl => lbl.toLocaleLowerCase()),
|
||||
pr.labels
|
||||
)
|
||||
) {
|
||||
pullRequests.push(body)
|
||||
matched = true
|
||||
if (category.exhaustive === true) {
|
||||
if (
|
||||
haveEveryElements(
|
||||
category.labels.map(lbl => lbl.toLocaleLowerCase()),
|
||||
pr.labels
|
||||
)
|
||||
) {
|
||||
pullRequests.push(body)
|
||||
matched = true
|
||||
}
|
||||
} else {
|
||||
if (
|
||||
haveCommonElements(
|
||||
category.labels.map(lbl => lbl.toLocaleLowerCase()),
|
||||
pr.labels
|
||||
)
|
||||
) {
|
||||
pullRequests.push(body)
|
||||
matched = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -213,6 +225,10 @@ function haveCommonElements(arr1: string[], arr2: Set<string>): Boolean {
|
||||
return arr1.some(item => arr2.has(item))
|
||||
}
|
||||
|
||||
function haveEveryElements(arr1: string[], arr2: Set<string>): Boolean {
|
||||
return arr1.every(item => arr2.has(item))
|
||||
}
|
||||
|
||||
function fillTemplate(pr: PullRequestInfo, template: string): string {
|
||||
let transformed = template
|
||||
transformed = transformed.replace(/\${{NUMBER}}/g, pr.number.toString())
|
||||
|
||||
Reference in New Issue
Block a user