- add ability to provide key for cateogry, used for json ('categorized') output
This commit is contained in:
@@ -1,14 +1,17 @@
|
|||||||
{
|
{
|
||||||
"categories": [
|
"categories": [
|
||||||
{
|
{
|
||||||
|
"key": "feature",
|
||||||
"title": "## 🚀 Features",
|
"title": "## 🚀 Features",
|
||||||
"labels": ["feature"]
|
"labels": ["feature"]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"key": "fixes",
|
||||||
"title": "## 🐛 Fixes",
|
"title": "## 🐛 Fixes",
|
||||||
"labels": ["fix"]
|
"labels": ["fix"]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"key": "tests",
|
||||||
"title": "## 🧪 Tests",
|
"title": "## 🧪 Tests",
|
||||||
"labels": ["test"]
|
"labels": ["test"]
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -1831,7 +1831,7 @@ function buildChangelog(diffInfo, prs, options) {
|
|||||||
}
|
}
|
||||||
core.info(`ℹ️ Ordered all pull requests into ${categories.length} categories`);
|
core.info(`ℹ️ Ordered all pull requests into ${categories.length} categories`);
|
||||||
// serialize and provide the categorized content as json
|
// 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));
|
core.setOutput('categorized', JSON.stringify(transformedCategorized));
|
||||||
// construct final changelog
|
// construct final changelog
|
||||||
let 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 {
|
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
|
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
|
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`)
|
core.info(`ℹ️ Ordered all pull requests into ${categories.length} categories`)
|
||||||
|
|
||||||
// serialize and provide the categorized content as json
|
// 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))
|
core.setOutput('categorized', JSON.stringify(transformedCategorized))
|
||||||
|
|
||||||
// construct final changelog
|
// construct final changelog
|
||||||
|
|||||||
Reference in New Issue
Block a user