Add --max-issues argument to limit requests
This addresses issue 71 by providing a configurable limit on the number of issues to retrieve. By default this limits the number of issues to 500 which should help users stay under the GitHub API limit and keep change logs from growing ridiculous in size for older repos.
This commit is contained in:
parent
d43ef05287
commit
90f6436af6
|
@ -96,6 +96,7 @@ Type `github_changelog_generator --help` for detailed usage.
|
|||
--[no-]compare-link Include compare link between older version and newer version. Default is true
|
||||
--include-labels x,y,z Issues only with that labels will be included to changelog. Default is 'bug,enhancement'
|
||||
--exclude-labels x,y,z Issues with that labels will be always excluded from changelog. Default is 'duplicate,question,invalid,wontfix'
|
||||
--max-issues [NUMBER] Max number of issues to fetch from GitHub. Default is 500.
|
||||
--github-site [URL] The Enterprise Github site on which your project is hosted.
|
||||
--github-api [URL] The enterprise endpoint to use for your Github API.
|
||||
-v, --version Print version number
|
||||
|
|
|
@ -596,6 +596,7 @@ begin
|
|||
page_i += PER_PAGE_NUMBER
|
||||
print "Fetching issues... #{page_i}/#{count_pages * PER_PAGE_NUMBER}\r"
|
||||
issues.concat(page)
|
||||
break if issues.length >= @options[:max_issues]
|
||||
end
|
||||
rescue
|
||||
puts "Warning: GitHub API rate limit exceed (5000 per hour), change log may not contain some issues.".yellow
|
||||
|
|
|
@ -24,6 +24,7 @@ module GitHubChangelogGenerator
|
|||
:enhancement_prefix => '**Implemented enhancements:**',
|
||||
:author => true,
|
||||
:filter_issues_by_milestone => true,
|
||||
:max_issues => 500,
|
||||
:compare_link => true,
|
||||
:unreleased => true,
|
||||
:unreleased_label => 'Unreleased',
|
||||
|
@ -83,6 +84,9 @@ module GitHubChangelogGenerator
|
|||
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('--max-issues [NUMBER]', Integer, 'Max number of issues to fetch from GitHub. Default is 500') do |max|
|
||||
options[:max_issues] = max
|
||||
end
|
||||
opts.on('--github-site [URL]', 'The Enterprise Github site on which your project is hosted.') do |last|
|
||||
options[:github_site] = last
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue
Block a user