diff --git a/lib/github_changelog_generator/generator/generator_generation.rb b/lib/github_changelog_generator/generator/generator_generation.rb index d642d57..337d377 100644 --- a/lib/github_changelog_generator/generator/generator_generation.rb +++ b/lib/github_changelog_generator/generator/generator_generation.rb @@ -8,7 +8,9 @@ module GitHubChangelogGenerator sort_tags_by_date(@filtered_tags) fetch_issues_and_pr - log = "#{@options[:header]}\n\n" + log = '' + log += @options[:frontmatter] if @options[:frontmatter] + log += "#{@options[:header]}\n\n" if @options[:unreleased_only] log += generate_log_between_tags(filtered_tags[0], nil) diff --git a/lib/github_changelog_generator/parser.rb b/lib/github_changelog_generator/parser.rb index 2f16d9b..f1440f0 100644 --- a/lib/github_changelog_generator/parser.rb +++ b/lib/github_changelog_generator/parser.rb @@ -68,6 +68,9 @@ module GitHubChangelogGenerator opts.on("--header-label [LABEL]", "Setup custom header label. Default is \"# Change Log\"") do |v| options[:header] = v end + opts.on("--front-matter [JSON]", "Add YAML front matter. Formatted as JSON because it's easier to add on the command line") do |v| + options[:frontmatter] = JSON.parse(v).to_yaml + "---\n" + end opts.on("--pr-label [LABEL]", "Setup custom label for pull requests section. Default is \"**Merged pull requests:**\"") do |v| options[:merge_prefix] = v end