Skip to content

Commit

Permalink
fix: Use auto pagination when retrieving environments
Browse files Browse the repository at this point in the history
  • Loading branch information
nickfloyd committed Mar 11, 2024
2 parents 9812dbc + d456a3a commit d2e6197
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/octokit/client/environments.rb
Expand Up @@ -24,7 +24,10 @@ def environment(repo, environment_name, options = {})
# @return [Sawyer::Resource] Total count of environments and list of environments
# @see https://docs.github.com/en/rest/deployments/environments#list-environments
def environments(repo, options = {})
get("#{Repository.path repo}/environments", options)
paginate("#{Repository.path repo}/environments", options) do |data, last_response|
data.environments.concat last_response.data.environments
data.total_count += last_response.data.total_count
end
end
alias list_environments environments

Expand Down

0 comments on commit d2e6197

Please sign in to comment.