Don't show untagged issues when desired

When `add_issues_wo_labels` is false, do not include issues that do not
have any labels in the CHANGELOG (per documentation).

Signed-off-by: Tom Duffield <tom@chef.io>
This commit is contained in:
Tom Duffield 2016-11-20 00:29:58 -06:00 committed by Hunter Haugen
parent b91609283e
commit 726f8f79fb
No known key found for this signature in database
GPG Key ID: EF99694AA599DDAD

View File

@ -126,19 +126,17 @@ module GitHubChangelogGenerator
# @return [Array] filtered array of issues # @return [Array] filtered array of issues
def include_issues_by_labels(issues) def include_issues_by_labels(issues)
filtered_issues = filter_by_include_labels(issues) filtered_issues = filter_by_include_labels(issues)
filtered_issues |= filter_wo_labels(issues) filtered_issues = filter_wo_labels(filtered_issues)
filtered_issues filtered_issues
end end
# @return [Array] issues without labels or empty array if add_issues_wo_labels is false # @return [Array] issues without labels or empty array if add_issues_wo_labels is false
def filter_wo_labels(issues) def filter_wo_labels(issues)
if options[:add_issues_wo_labels] if options[:add_issues_wo_labels]
issues_wo_labels = issues.reject do |issue| issues
issue["labels"].map { |l| l["name"] }.none? else
issues.reject { |issue| !issue["labels"].map { |l| l["name"] }.any? }
end end
return issues_wo_labels
end
[]
end end
def filter_by_include_labels(issues) def filter_by_include_labels(issues)