diff --git a/tap_github/repository_streams.py b/tap_github/repository_streams.py index d8505284..cb5520a9 100644 --- a/tap_github/repository_streams.py +++ b/tap_github/repository_streams.py @@ -1603,8 +1603,11 @@ def get_next_page_token( # If since parameter is present, try to exit early by looking at the last "starred_at". # Noting that we are traversing in DESCENDING order by STARRED_AT. if since: - results = extract_jsonpath(self.query_jsonpath, input=response.json()) - *_, last = results + results = list(extract_jsonpath(self.query_jsonpath, input=response.json())) + # If no results, return None to exit early. + if len(results) == 0: + return None + last = results[-1] if parse(last["starred_at"]) < parse(since): return None return super().get_next_page_token(response, previous_token)