implement eclude labels feature. Fix #52.
This commit is contained in:
parent
9b8291ab69
commit
48e3a75251
|
@ -5,8 +5,6 @@
|
||||||
|
|
||||||
- *Merged pull-request:* Implement filtering of Pull Requests by milestones [\#50](https://github.com/skywinder/Github-Changelog-Generator/pull/50) ([skywinder](https://github.com/skywinder))
|
- *Merged pull-request:* Implement filtering of Pull Requests by milestones [\#50](https://github.com/skywinder/Github-Changelog-Generator/pull/50) ([skywinder](https://github.com/skywinder))
|
||||||
|
|
||||||
- *Implemented enhancement:* Add support for forked repo \(to extend changelog with parent's changes\) [\#21](https://github.com/skywinder/Github-Changelog-Generator/issues/21)
|
|
||||||
|
|
||||||
## [1.2.8](https://github.com/skywinder/Github-Changelog-Generator/tree/1.2.8) (2015-02-17)
|
## [1.2.8](https://github.com/skywinder/Github-Changelog-Generator/tree/1.2.8) (2015-02-17)
|
||||||
[Full Changelog](https://github.com/skywinder/Github-Changelog-Generator/compare/1.2.7...1.2.8)
|
[Full Changelog](https://github.com/skywinder/Github-Changelog-Generator/compare/1.2.7...1.2.8)
|
||||||
|
|
||||||
|
|
|
@ -502,11 +502,21 @@ module GitHubChangelogGenerator
|
||||||
x.pull_request == nil
|
x.pull_request == nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
filtered_issues = []
|
||||||
|
|
||||||
|
unless @options[:include_labels].nil?
|
||||||
filtered_issues = issues.select { |issue|
|
filtered_issues = issues.select { |issue|
|
||||||
#compare is there any labels from @options[:labels] array
|
#add all labels from @options[:incluse_labels] array
|
||||||
(issue.labels.map { |label| label.name } & @options[:include_labels]).any?
|
(issue.labels.map { |label| label.name } & @options[:include_labels]).any?
|
||||||
}
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
unless @options[:exclude_labels].nil?
|
||||||
|
filtered_issues = filtered_issues.select { |issue|
|
||||||
|
#delete all labels from @options[:exclude_labels] array
|
||||||
|
!(issue.labels.map { |label| label.name } & @options[:exclude_labels]).any?
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
if @options[:add_issues_wo_labels]
|
if @options[:add_issues_wo_labels]
|
||||||
issues_wo_labels = issues.select {
|
issues_wo_labels = issues.select {
|
||||||
|
|
|
@ -6,7 +6,7 @@ require_relative 'version'
|
||||||
module GitHubChangelogGenerator
|
module GitHubChangelogGenerator
|
||||||
class Parser
|
class Parser
|
||||||
def self.parse_options
|
def self.parse_options
|
||||||
options = {:tag1 => nil, :tag2 => nil, :format => '%Y-%m-%d', :output => 'CHANGELOG.md', :include_labels => %w(bug enhancement), :pulls => true, :issues => true, :verbose => true, :add_issues_wo_labels => true, :merge_prefix => '*Merged pull-request:* ', :author => true, :pull_request_labels => nil, :filter_issues_by_milestone => true, :compare_link => true, :unreleased => true}
|
options = {:tag1 => nil, :tag2 => nil, :format => '%Y-%m-%d', :output => 'CHANGELOG.md', :include_labels => %w(bug enhancement), :exclude_labels => %w(duplicate question invalid wontfix), :pulls => true, :issues => true, :verbose => true, :add_issues_wo_labels => true, :merge_prefix => '*Merged pull-request:* ', :author => true, :pull_request_labels => nil, :filter_issues_by_milestone => true, :compare_link => true, :unreleased => true}
|
||||||
|
|
||||||
parser = OptionParser.new { |opts|
|
parser = OptionParser.new { |opts|
|
||||||
opts.banner = 'Usage: changelog_generator [options]'
|
opts.banner = 'Usage: changelog_generator [options]'
|
||||||
|
@ -52,9 +52,12 @@ module GitHubChangelogGenerator
|
||||||
opts.on('--[no-]compare-link', 'Include compare link between older version and newer version. Default is true') do |v|
|
opts.on('--[no-]compare-link', 'Include compare link between older version and newer version. Default is true') do |v|
|
||||||
options[:compare_link] = v
|
options[:compare_link] = v
|
||||||
end
|
end
|
||||||
opts.on('--include-labels x,y,z', Array, 'Issues with that labels will be included to changelog. Default is \'bug,enhancement\'') do |list|
|
opts.on('--include-labels x,y,z', Array, 'Issues only with that labels will be included to changelog. Default is \'bug,enhancement\'') do |list|
|
||||||
options[:include_labels] = list
|
options[:include_labels] = list
|
||||||
end
|
end
|
||||||
|
opts.on('--exclude-labels x,y,z', Array, 'Issues with that labels will be always excluded from changelog. Default is \'duplicate,question,invalid,wontfix\'') do |list|
|
||||||
|
options[:exclude_labels] = list
|
||||||
|
end
|
||||||
opts.on('--labels-pr x,y,z', Array, 'Only pull requests with specified labels will be included to changelog. Default is nil') do |list|
|
opts.on('--labels-pr x,y,z', Array, 'Only pull requests with specified labels will be included to changelog. Default is nil') do |list|
|
||||||
options[:pull_request_labels] = list
|
options[:pull_request_labels] = list
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue
Block a user