- add ability to provide key for cateogry, used for json ('categorized') output
This commit is contained in:
@@ -1,14 +1,17 @@
|
||||
{
|
||||
"categories": [
|
||||
{
|
||||
"key": "feature",
|
||||
"title": "## 🚀 Features",
|
||||
"labels": ["feature"]
|
||||
},
|
||||
{
|
||||
"key": "fixes",
|
||||
"title": "## 🐛 Fixes",
|
||||
"labels": ["fix"]
|
||||
},
|
||||
{
|
||||
"key": "tests",
|
||||
"title": "## 🧪 Tests",
|
||||
"labels": ["test"]
|
||||
}
|
||||
|
||||
+1
-1
@@ -1831,7 +1831,7 @@ function buildChangelog(diffInfo, prs, options) {
|
||||
}
|
||||
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
|
||||
let changelog = '';
|
||||
|
||||
+1
-1
File diff suppressed because one or more lines are too long
@@ -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
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user