Ensure github module is installed before running PR commands (#1777)
* Ensure github module is installed before running PR commands * move go and elastic-package assertions to top of command * update error msg for missing pkg * remove redundant github assertion Co-authored-by: Colson Wilhoit <48036388+DefSecSentinel@users.noreply.github.com>
This commit is contained in:
@@ -103,14 +103,17 @@ class GithubClient:
|
||||
|
||||
def __init__(self, token: Optional[str] = None):
|
||||
"""Get an unauthenticated client, verified authenticated client, or a default client."""
|
||||
if not Github:
|
||||
raise ModuleNotFoundError('Missing PyGithub - try running `pip install -r requirements-dev.txt`')
|
||||
|
||||
self.assert_github()
|
||||
self.client: Github = Github(token)
|
||||
self.unauthenticated_client = Github()
|
||||
self.__token = token
|
||||
self.__authenticated_client = None
|
||||
|
||||
@classmethod
|
||||
def assert_github(cls):
|
||||
if not Github:
|
||||
raise ModuleNotFoundError('Missing PyGithub - try running `pip install -r requirements-dev.txt`')
|
||||
|
||||
@property
|
||||
def authenticated_client(self) -> Github:
|
||||
if not self.__token:
|
||||
|
||||
Reference in New Issue
Block a user