- add ability to provide key for cateogry, used for json ('categorized') output

This commit is contained in:
Mike Penz
2023-05-25 17:59:11 +00:00
committed by GitHub
parent be9b53104e
commit 5d46efec54
5 changed files with 9 additions and 3 deletions
+1
View File
@@ -19,6 +19,7 @@ export interface Configuration {
}
export interface Category {
key?: string // a key for this category. This is currently only used for the json output
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
+3 -1
View File
@@ -180,7 +180,9 @@ export function buildChangelog(diffInfo: DiffInfo, prs: PullRequestInfo[], optio
core.info(`️ Ordered all pull requests into ${categories.length} categories`)
// serialize and provide the categorized content as json
const transformedCategorized = Array.from(categorized).reduce((obj, [key, value]) => Object.assign(obj, {[key.title]: value}), {})
const transformedCategorized = Array.from(categorized).reduce(
(obj, [key, value]) => Object.assign(obj, {[key.key || key.title]: value}), {}
)
core.setOutput('categorized', JSON.stringify(transformedCategorized))
// construct final changelog