Skip to content

Commit

Permalink
Merge pull request #18 from runwaylab/per-page-value
Browse files Browse the repository at this point in the history
Use a set value for `per_page` when fetching GitHub deployment statuses
  • Loading branch information
GrantBirki authored May 8, 2024
2 parents 3debce2 + 1bcdc27 commit 5dcdec2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
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

0 comments on commit 5dcdec2

Please sign in to comment.