diff --git a/README.md b/README.md index ccc650a..a97042c 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/lib/github_changelog_generator.rb b/lib/github_changelog_generator.rb index 3e51717..03fcdb2 100755 --- a/lib/github_changelog_generator.rb +++ b/lib/github_changelog_generator.rb @@ -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 diff --git a/lib/github_changelog_generator/parser.rb b/lib/github_changelog_generator/parser.rb index b23eead..f86d4c3 100644 --- a/lib/github_changelog_generator/parser.rb +++ b/lib/github_changelog_generator/parser.rb @@ -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