Add category title to changelog only if present; avoid "undefined" if not specified.
This commit is contained in:
+6
-2
@@ -173,14 +173,18 @@ export function buildChangelog(diffInfo: DiffInfo, prs: PullRequestInfo[], optio
|
|||||||
let changelog = ''
|
let changelog = ''
|
||||||
for (const [category, pullRequests] of categorized) {
|
for (const [category, pullRequests] of categorized) {
|
||||||
if (pullRequests.length > 0) {
|
if (pullRequests.length > 0) {
|
||||||
changelog = `${changelog + category.title}\n\n`
|
if (category.title) {
|
||||||
|
changelog = `${changelog + category.title}\n\n`
|
||||||
|
}
|
||||||
|
|
||||||
for (const pr of pullRequests) {
|
for (const pr of pullRequests) {
|
||||||
changelog = `${changelog + pr}\n`
|
changelog = `${changelog + pr}\n`
|
||||||
}
|
}
|
||||||
changelog = `${changelog}\n` // add space between sections
|
changelog = `${changelog}\n` // add space between sections
|
||||||
} else if (category.empty_content !== undefined) {
|
} else if (category.empty_content !== undefined) {
|
||||||
changelog = `${changelog + category.title}\n\n`
|
if (category.title) {
|
||||||
|
changelog = `${changelog + category.title}\n\n`
|
||||||
|
}
|
||||||
changelog = `${changelog + category.empty_content}\n\n`
|
changelog = `${changelog + category.empty_content}\n\n`
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user