Merge pull request #271 from raphink/dev/pr_delete

Do not alter pull_requests while iterating on it
This commit is contained in:
Petr Korolev 2015-08-27 14:59:06 +03:00
commit 127ffee93f

View File

@ -120,22 +120,22 @@ module GitHubChangelogGenerator
issues_a.push dict unless added issues_a.push dict unless added
end end
added_pull_requests = []
pull_requests.each do |dict| pull_requests.each do |dict|
added = false
dict.labels.each do |label| dict.labels.each do |label|
if @options[:bug_labels].include? label.name if @options[:bug_labels].include? label.name
bugs_a.push dict bugs_a.push dict
added = true added_pull_requests.push dict
next next
end end
if @options[:enhancement_labels].include? label.name if @options[:enhancement_labels].include? label.name
enhancement_a.push dict enhancement_a.push dict
added = true added_pull_requests.push dict
next next
end end
end end
pull_requests.delete(dict) if added
end end
added_pull_requests.each { |p| pull_requests.delete(p) }
[bugs_a, enhancement_a, issues_a] [bugs_a, enhancement_a, issues_a]
end end