From f4f8a1250931d37bc0fb7cfcfc54bc39497b7791 Mon Sep 17 00:00:00 2001 From: Ruoyu Zhong Date: Wed, 24 Apr 2024 04:03:29 +0800 Subject: [PATCH] utils/github/api: support passing `scopes` in `paginate_rest` --- Library/Homebrew/utils/github/api.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Library/Homebrew/utils/github/api.rb b/Library/Homebrew/utils/github/api.rb index f783fbab93..225b5617f3 100644 --- a/Library/Homebrew/utils/github/api.rb +++ b/Library/Homebrew/utils/github/api.rb @@ -284,11 +284,11 @@ module GitHub end end - def self.paginate_rest(url, additional_query_params: nil, per_page: 100) + def self.paginate_rest(url, additional_query_params: nil, per_page: 100, scopes: [].freeze) (1..API_MAX_PAGES).each do |page| retry_count = 1 result = begin - API.open_rest("#{url}?per_page=#{per_page}&page=#{page}&#{additional_query_params}") + API.open_rest("#{url}?per_page=#{per_page}&page=#{page}&#{additional_query_params}", scopes:) rescue Error if retry_count < PAGINATE_RETRY_COUNT retry_count += 1