Commit 60053c12 authored by Rémy Coutable's avatar Rémy Coutable

Fetch 100 results when calling the GitHub API in Github::Import

Signed-off-by: default avatarRémy Coutable <remy@rymai.me>
parent 3b2d68d3
...@@ -115,7 +115,7 @@ module Github ...@@ -115,7 +115,7 @@ module Github
url = "/repos/#{repo}/labels" url = "/repos/#{repo}/labels"
while url while url
response = Github::Client.new(options).get(url) response = Github::Client.new(options).get(url, per_page: 100)
response.body.each do |raw| response.body.each do |raw|
begin begin
...@@ -139,7 +139,7 @@ module Github ...@@ -139,7 +139,7 @@ module Github
url = "/repos/#{repo}/milestones" url = "/repos/#{repo}/milestones"
while url while url
response = Github::Client.new(options).get(url, state: :all) response = Github::Client.new(options).get(url, state: :all, per_page: 100)
response.body.each do |raw| response.body.each do |raw|
begin begin
...@@ -168,7 +168,7 @@ module Github ...@@ -168,7 +168,7 @@ module Github
url = "/repos/#{repo}/pulls" url = "/repos/#{repo}/pulls"
while url while url
response = Github::Client.new(options).get(url, state: :all, sort: :created, direction: :asc) response = Github::Client.new(options).get(url, state: :all, sort: :created, direction: :asc, per_page: 100)
response.body.each do |raw| response.body.each do |raw|
pull_request = Github::Representation::PullRequest.new(raw, options.merge(project: project)) pull_request = Github::Representation::PullRequest.new(raw, options.merge(project: project))
...@@ -224,7 +224,7 @@ module Github ...@@ -224,7 +224,7 @@ module Github
url = "/repos/#{repo}/issues" url = "/repos/#{repo}/issues"
while url while url
response = Github::Client.new(options).get(url, state: :all, sort: :created, direction: :asc) response = Github::Client.new(options).get(url, state: :all, sort: :created, direction: :asc, per_page: 100)
response.body.each { |raw| populate_issue(raw) } response.body.each { |raw| populate_issue(raw) }
...@@ -276,7 +276,7 @@ module Github ...@@ -276,7 +276,7 @@ module Github
def fetch_comments(noteable, type, url, klass = Note) def fetch_comments(noteable, type, url, klass = Note)
while url while url
comments = Github::Client.new(options).get(url) comments = Github::Client.new(options).get(url, per_page: 100)
ActiveRecord::Base.no_touching do ActiveRecord::Base.no_touching do
comments.body.each do |raw| comments.body.each do |raw|
...@@ -308,7 +308,7 @@ module Github ...@@ -308,7 +308,7 @@ module Github
url = "/repos/#{repo}/releases" url = "/repos/#{repo}/releases"
while url while url
response = Github::Client.new(options).get(url) response = Github::Client.new(options).get(url, per_page: 100)
response.body.each do |raw| response.body.each do |raw|
representation = Github::Representation::Release.new(raw) representation = Github::Representation::Release.new(raw)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment