diff --git a/lib/CHANGELOG.md b/lib/CHANGELOG.md index c82ce18..f9f5146 100644 --- a/lib/CHANGELOG.md +++ b/lib/CHANGELOG.md @@ -21,6 +21,8 @@ **Merged pull requests:** +- This a PR with a lot of comments and events [\#17](https://github.com/skywinder/changelog_test/pull/17) ([skywinder](https://github.com/skywinder)) +- PR [\#16](https://github.com/skywinder/changelog_test/pull/16) ([skywinder](https://github.com/skywinder)) - This PR closes 14 from commit [\#15](https://github.com/skywinder/changelog_test/pull/15) ([skywinder](https://github.com/skywinder)) - This PR to close \#12 from body [\#13](https://github.com/skywinder/changelog_test/pull/13) ([skywinder](https://github.com/skywinder)) diff --git a/lib/github_changelog_generator/fetcher.rb b/lib/github_changelog_generator/fetcher.rb index b6175bb..fa81112 100644 --- a/lib/github_changelog_generator/fetcher.rb +++ b/lib/github_changelog_generator/fetcher.rb @@ -163,10 +163,13 @@ Make sure, that you push tags to remote repo via 'git push --tags'".yellow issues_slice.each do |issue| threads << Thread.new do begin - obj = @github.issues.events.list user: @options[:user], - repo: @options[:project], - issue_number: issue["number"] - issue[:events] = obj.body + response = @github.issues.events.list user: @options[:user], + repo: @options[:project], + issue_number: issue["number"] + issue[:events] = [] + response.each_page do |page| + issue[:events].concat(page) + end rescue Helper.log.warn GH_RATE_LIMIT_EXCEEDED_MSG.yellow end diff --git a/lib/github_changelog_generator/generator/generator_fetcher.rb b/lib/github_changelog_generator/generator/generator_fetcher.rb index b166922..988f3ed 100644 --- a/lib/github_changelog_generator/generator/generator_fetcher.rb +++ b/lib/github_changelog_generator/generator/generator_fetcher.rb @@ -48,11 +48,11 @@ module GitHubChangelogGenerator # Fill :actual_date parameter of specified issue by closed date of the commit, if it was closed by commit. # @param [Hash] issue def find_closed_date_by_commit(issue) - unless issue["events"].nil? + unless issue[:events].nil? # if it's PR -> then find "merged event", in case of usual issue -> fond closed date compare_string = issue[:merged_at].nil? ? "closed" : "merged" # reverse! - to find latest closed event. (event goes in date order) - issue["events"].reverse!.each do |event| + issue[:events].reverse!.each do |event| if event[:event].eql? compare_string set_date_from_event(event, issue) break diff --git a/lib/github_changelog_generator/generator/generator_processor.rb b/lib/github_changelog_generator/generator/generator_processor.rb index d162cbc..e264a90 100644 --- a/lib/github_changelog_generator/generator/generator_processor.rb +++ b/lib/github_changelog_generator/generator/generator_processor.rb @@ -63,21 +63,21 @@ module GitHubChangelogGenerator end # Method filter issues, that belong only specified tag range - # @param [Array] array of issues to filter + # @param [Array] issues issues to filter # @param [Symbol] hash_key key of date value default is :actual_date # @param [String] older_tag all issues before this tag date will be excluded. May be nil, if it's first tag # @param [String] newer_tag all issue after this tag will be excluded. May be nil for unreleased section # @return [Array] filtered issues - def delete_by_time(array, hash_key = :actual_date, older_tag = nil, newer_tag = nil) + def delete_by_time(issues, hash_key = :actual_date, older_tag = nil, newer_tag = nil) # in case if not tags specified - return unchanged array - return array if older_tag.nil? && newer_tag.nil? + return issues if older_tag.nil? && newer_tag.nil? newer_tag_time = newer_tag && get_time_of_tag(newer_tag) older_tag_time = older_tag && get_time_of_tag(older_tag) - array.select do |req| - if req[hash_key] - time = Time.parse(req[hash_key]).utc + issues.select do |issue| + if issue[hash_key] + time = Time.parse(issue[hash_key]).utc tag_in_range_old = tag_newer_old_tag?(older_tag_time, time)