Skip to content

Commit

Permalink
option to disable empty sections
Browse files Browse the repository at this point in the history
  • Loading branch information
Vrtak-CZ committed Jan 24, 2020
1 parent 8abd81c commit f9a0186
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ These can be specified using environment variables
* Default "Australia/Melbourne"
* 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.
* Default 0
* 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.
* Default `"true"`

## Building and Running locally

Expand Down
3 changes: 2 additions & 1 deletion app/env.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ exports.NODE_ENV = process.env.NODE_ENV;

// 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
// example -e GITLAB_ISSUE_SECOND_DELAY=60 will catch issues closed up to 60 seconds after the tag is created.
exports.ISSUE_CLOSED_SECONDS = process.env.ISSUE_CLOSED_SECONDS || "0";
exports.ISSUE_CLOSED_SECONDS = process.env.ISSUE_CLOSED_SECONDS || "0";
exports.RENDER_EMPTY_SECTIONS = process.env.RENDER_EMPTY_SECTIONS === "false" ? false : true;
2 changes: 1 addition & 1 deletion app/lib/changelog.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ exports.generateChangeLogContent = async ({ releaseDate, issues, mergeRequests }
let changelogContent = `### Release note (${Moment.tz(releaseDate, Env.TZ).format("YYYY-MM-DD")})\n`;
for (const labelConfig of labelConfigs) {
if (changelogBucket[labelConfig.name]) {
if (!_.isEmpty(changelogBucket[labelConfig.name]) || labelConfig.default) {
if (!_.isEmpty(changelogBucket[labelConfig.name]) || (labelConfig.default && Env.RENDER_EMPTY_SECTIONS)) {
changelogContent += `#### ${labelConfig.title}\n`;
if (!_.isEmpty(changelogBucket[labelConfig.name])) changelogContent += changelogBucket[labelConfig.name].join("\n") + "\n";
}
Expand Down

0 comments on commit f9a0186

Please sign in to comment.