Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use a set value for per_page when fetching GitHub deployment statuses #18

Merged
merged 2 commits into from
May 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/runway/events/github_deployment.cr
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ class GitHubDeployment < BaseEvent
# however, the "in_progress" status must be the most recent status for the deployment or we'll ignore it
deployments.each do |deployment|
deployment_id = deployment["id"].to_s.to_i
statuses = @github.list_deployment_statuses(@event.repo.not_nil!, deployment_id)
statuses = @github.list_deployment_statuses(@event.repo.not_nil!, deployment_id, per_page: 100)
statuses = JSON.parse(statuses.records.to_json).as_a

# sort statuses by created_at date with the most recent first
Expand Down
4 changes: 2 additions & 2 deletions src/runway/services/github.cr
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ module Runway
end
end

def list_deployment_statuses(repo : String, deployment_id : Int32) : Octokit::Connection::Paginator(Octokit::Models::DeploymentStatus)
def list_deployment_statuses(repo : String, deployment_id : Int32, per_page : Int32 = 30) : Octokit::Connection::Paginator(Octokit::Models::DeploymentStatus)
Retriable.retry do
check_rate_limit!
@client.list_deployment_statuses(repo, deployment_id)
@client.list_deployment_statuses(repo, deployment_id, per_page: per_page)
end
end

Expand Down