π OpenHands: AI-Driven Development
Use generic token check in order to support Github Apps (#8048)
Tom Deckerscfae2a36070e
diff --git a/openhands/integrations/github/github_service.py b/openhands/integrations/github/github_service.pyindex 3b8fa76bbf..fd09d86b4e 100644--- a/openhands/integrations/github/github_service.py+++ b/openhands/integrations/github/github_service.py@@ -120,6 +120,12 @@ class GitHubService(BaseGitService, GitService):email=response.get('email'),)+ async def verify_access(self) -> bool:+ """Verify if the token is valid by making a simple request."""+ url = f'{self.BASE_URL}'+ await self._make_request(url)+ return True+async def _fetch_paginated_repos(self, url: str, params: dict, max_repos: int, extract_key: str | None = None) -> list[dict]:diff --git a/openhands/integrations/utils.py b/openhands/integrations/utils.pyindex e99d9a3d8a..303fd9cb9b 100644--- a/openhands/integrations/utils.py+++ b/openhands/integrations/utils.py@@ -23,7 +23,7 @@ async def validate_provider_token(# Try GitHub firsttry:github_service = GitHubService(token=token, base_domain=base_domain)- await github_service.get_user()+ await github_service.verify_access()return ProviderType.GITHUBexcept Exception:pass