Copilot commented on code in PR #50533:
URL: https://github.com/apache/arrow/pull/50533#discussion_r3608619535


##########
dev/archery/archery/crossbow/core.py:
##########
@@ -448,10 +448,12 @@ def file_contents(self, commit_id, file):
         return blob.data
 
     def _github_login(self, github_token=None):
-        """Returns a logged in Github instance using PyGithub"""
+        """Returns a Github instance, optionally authenticated with a token"""
         if not _have_github:
             raise ImportError('Must install PyGithub')
         github_token = github_token or self.github_token
+        if not github_token:
+            return Github(timeout=30)
         return Github(auth=GithubAuth.Token(github_token), timeout=30)

Review Comment:
   Unauthenticated fallback can populate the cached GitHub repo via 
as_github_repo(); subsequent calls that provide a token will reuse the 
unauthenticated cached repo because the cache isn’t keyed by token. This can 
lead to surprising 401/rate-limit issues when a command first does public reads 
without a token and later needs authenticated operations in the same process.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to