Skip to content

Commit f15b599

Browse files
committed
option to disable empty sections
1 parent e3ecd03 commit f15b599

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ These can be specified using environment variables
6868
* Default "Australia/Melbourne"
6969
* ISSUE_CLOSED_SECONDS: The amount of seconds to search after the last commit, useful for Merge Requests that close their tickets a second after the commit.
7070
* Default 0
71+
* RENDER_EMPTY_SECTIONS: Option to render empty default sections. _Closed Issues_ and _Merged merge requests_ are default and renders all the time, even when they are empty. With this option set to `"false"` this tool will not generate them if they are empty.
72+
* Default `"true"`
7173

7274
## Building and Running locally
7375

app/env.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,5 @@ exports.NODE_ENV = process.env.NODE_ENV;
88

99
// will looks for issues closed this many seconds after the tag, this may happen if the issue is merged via a MR and automatially closed
1010
// example -e GITLAB_ISSUE_SECOND_DELAY=60 will catch issues closed up to 60 seconds after the tag is created.
11-
exports.ISSUE_CLOSED_SECONDS = process.env.ISSUE_CLOSED_SECONDS || "0";
11+
exports.ISSUE_CLOSED_SECONDS = process.env.ISSUE_CLOSED_SECONDS || "0";
12+
exports.RENDER_EMPTY_SECTIONS = process.env.RENDER_EMPTY_SECTIONS === "false" ? false : true;

app/lib/changelog.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ exports.generateChangeLogContent = async ({ releaseDate, issues, mergeRequests }
4646
let changelogContent = `### Release note (${Moment.tz(releaseDate, Env.TZ).format("YYYY-MM-DD")})\n`;
4747
for (const labelConfig of labelConfigs) {
4848
if (changelogBucket[labelConfig.name]) {
49-
if (!_.isEmpty(changelogBucket[labelConfig.name]) || labelConfig.default) {
49+
if (!_.isEmpty(changelogBucket[labelConfig.name]) || (labelConfig.default && Env.RENDER_EMPTY_SECTIONS)) {
5050
changelogContent += `#### ${labelConfig.title}\n`;
5151
if (!_.isEmpty(changelogBucket[labelConfig.name])) changelogContent += changelogBucket[labelConfig.name].join("\n") + "\n";
5252
}

0 commit comments

Comments
 (0)