- introduce new configuration option, allowing to provide an empty_content for categories matching no PRs

- FIX https://github.com/mikepenz/release-changelog-builder-action/issues/804
This commit is contained in:
Mike Penz
2022-07-08 10:40:47 +02:00
parent 9628cd4fe0
commit 89475f1193
6 changed files with 46 additions and 7 deletions
+32
View File
@@ -456,6 +456,38 @@ it('Deduplicate duplicated PRs DESC', async () => {
)
})
it('Use empty_content for empty category', async () => {
const customConfig = Object.assign({}, DefaultConfiguration)
customConfig.categories = [
{
title: '## 🚀 Features and 🐛 Issues',
labels: ['Never-Matching-Category'],
empty_content: "- No PRs in this category"
},
{
title: '## 🚀 Features',
labels: ['Feature'],
}
]
const resultChangelog = buildChangelog(pullRequestsWithLabels, {
owner: 'mikepenz',
repo: 'test-repo',
fromTag: '1.0.0',
toTag: '2.0.0',
includeOpen: false,
failOnError: false,
fetchReviewers: false,
commitMode: false,
configuration: customConfig
})
expect(resultChangelog).toStrictEqual(
`## 🚀 Features and 🐛 Issues\n\n- No PRs in this category\n\n## 🚀 Features\n\n- [ABC-1234] - this is a PR 1 title message\n - PR: #1\n- [ABC-1234] - this is a PR 3 title message\n - PR: #3\n\n`
)
})
it('Commit SHA-1 in commitMode', async () => {
const customConfig = Object.assign({}, DefaultConfiguration)
customConfig.sort = "DESC"