diff --git a/image/src/github_actions/api.py b/image/src/github_actions/api.py index 3f8c0652..4ddb50d5 100644 --- a/image/src/github_actions/api.py +++ b/image/src/github_actions/api.py @@ -23,6 +23,7 @@ def __init__(self, host: str, token: Optional[str], cache_path: Optional[str] = if cache_path is not None: urls_expire_after = { re.compile(r'/repos/.*/.*/issues/\d+/comments'): 60 * 60 * 24 * 3, + re.compile(r'/repositories/.*/issues/.*/comments'): 60 * 60 * 24 * 3, '*': EXPIRE_IMMEDIATELY } @@ -74,6 +75,7 @@ def patch(self, path: str, **kwargs: Any) -> Response: def paged_get(self, url: GitHubUrl, *args, **kwargs) -> Iterable[dict[str, Any]]: while True: + response = self.api_request('GET', url, *args, **kwargs) response.raise_for_status() @@ -83,6 +85,9 @@ def paged_get(self, url: GitHubUrl, *args, **kwargs) -> Iterable[dict[str, Any]] yield from response.json() if 'next' in response.links: + if 'params' in kwargs: + # Relevant params are already in the link URL + del kwargs['params'] url = response.links['next']['url'] else: return diff --git a/tests/requirements.txt b/tests/requirements.txt index 1282130b..94e0ec72 100644 --- a/tests/requirements.txt +++ b/tests/requirements.txt @@ -1,4 +1,5 @@ requests +requests-cache pytest python-hcl2 canonicaljson