Skip to content

Commit

Permalink
[REGRESSION] Unauthenticated request to list PR files triggering rate…
Browse files Browse the repository at this point in the history
…-limits

https://bugs.webkit.org/show_bug.cgi?id=251157
rdar://104659979

Reviewed by Aakash Jain.

Without authentication, ews-build.webkit.org very quickly hits GitHub's rate limits.
After 259282@main, our request to list files in a PR was no longer authenticated.

* Tools/CISupport/ews-build/events.py:
(GitHubEventHandlerNoEdits._get_pr_files): Use Basic authentication when listing files.

Canonical link: https://commits.webkit.org/259382@main
  • Loading branch information
JonWBedard committed Jan 25, 2023
1 parent 7c41fd9 commit 42ad013
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions Tools/CISupport/ews-build/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,9 +268,8 @@ def _get_pr_files(self, repo, number):
PER_PAGE_LIMIT = 100 # GitHub will list a maximum of 100 files in a single response
NUM_PAGE_LIMIT = 30 # GitHub stops returning files in a PR after 3000 files

headers = {}
if self._token:
headers["Authorization"] = "token " + self._token
username, access_token = GitHub.credentials(user=user)
auth_header = b64encode('{}:{}'.format(username, access_token).encode('utf-8')).decode('utf-8')

page = 1
files = []
Expand All @@ -281,8 +280,10 @@ def _get_pr_files(self, repo, number):
params=dict(
per_page=PER_PAGE_LIMIT,
page=page,
), headers=headers,
logger=log.msg,
), headers=dict(
Authorization=['Basic {}'.format(auth_header)],
Accept=['application/vnd.github.v3+json'],
), logger=log.msg,
)
if not response or response.status_code // 100 != 2:
break
Expand Down

0 comments on commit 42ad013

Please sign in to comment.