Openverse is a search engine for openly-licensed media. This monorepo includes all application code.
Paginate GitHub events query for PR reminders (#2081)
Madison Swain-Bowden6ff37c459c96
diff --git a/catalog/dags/common/github.py b/catalog/dags/common/github.pyindex 6adb103bd..6604d72ae 100644--- a/catalog/dags/common/github.py+++ b/catalog/dags/common/github.py@@ -55,10 +55,19 @@ class GitHubAPI:)def get_issue_events(self, repo: str, issue_number: int, owner: str = "WordPress"):- return self._make_request(+ # GitHub by default returns only 30 results, so we need to paginate over+ # all of them to get the full list of events+ # https://docs.github.com/en/rest/issues/events?apiVersion=2022-11-28#list-issue-events+ page = 1+ all_events = []+ while events := self._make_request("GET",f"repos/{owner}/{repo}/issues/{issue_number}/events",- )+ params={"page": page},+ ):+ all_events.extend(events)+ page += 1+ return all_eventsdef delete_issue_comment(self, repo: str, comment_id: int, owner: str = "WordPress"