From cdc009b4ad1ca1ea9b3484d90416979baec5c994 Mon Sep 17 00:00:00 2001 From: Petr Korolev Date: Mon, 10 Nov 2014 16:59:11 +0200 Subject: [PATCH] Remove duplicates of issues and pull-requests with same number --- lib/github_changelog_generator.rb | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/github_changelog_generator.rb b/lib/github_changelog_generator.rb index 195b0a3..6459152 100755 --- a/lib/github_changelog_generator.rb +++ b/lib/github_changelog_generator.rb @@ -80,11 +80,6 @@ class ChangelogGenerator log += self.generate_log_for_all_tags end - - if @options[:verbose] - puts log - end - log += "\n\n\\* *This changelog was generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*" output_filename = "#{@options[:output]}" @@ -303,6 +298,7 @@ class ChangelogGenerator issues_req = @github.issues.list user: @options[:user], repo: @options[:project], state: 'closed', filter: 'all', labels: nil filtered_issues = issues_req.body.select { |issues| + #compare is there any labels from @options[:labels] array (issues.labels.map { |issue| issue.name } & @options[:labels]).any? } @@ -313,6 +309,11 @@ class ChangelogGenerator filtered_issues.concat(issues_wo_labels) end + # remove pull request from issues: + filtered_issues.select! { |x| + x.pull_request == nil + } + if @options[:verbose] puts "Receive all closed issues with labels #{@options[:labels]}: #{all_issues.count} issues" end