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

fix: Use auto pagination when retrieving environments #1673

Merged
merged 1 commit into from Mar 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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