r"""Initializes a new instance of the GitHubToolkit class. Args: repo_name (str): The name of the GitHub repository. access_token (str, optional): The access token to authenticate with GitHub. If not provided, it will be obtained using the
(
self, repo_name: str, access_token: Optional[str] = None
)
| 39 | |
| 40 | @dependencies_required('github') |
| 41 | def __init__( |
| 42 | self, repo_name: str, access_token: Optional[str] = None |
| 43 | ) -> None: |
| 44 | r"""Initializes a new instance of the GitHubToolkit class. |
| 45 | |
| 46 | Args: |
| 47 | repo_name (str): The name of the GitHub repository. |
| 48 | access_token (str, optional): The access token to authenticate |
| 49 | with GitHub. If not provided, it will be obtained using the |
| 50 | `get_github_access_token` method. |
| 51 | """ |
| 52 | from github import Auth, Github |
| 53 | |
| 54 | if access_token is None: |
| 55 | access_token = self.get_github_access_token() |
| 56 | |
| 57 | self.github = Github(auth=Auth.Token(access_token)) |
| 58 | self.repo = self.github.get_repo(repo_name) |
| 59 | |
| 60 | def get_github_access_token(self) -> str: |
| 61 | r"""Retrieve the GitHub access token from environment variables. |
nothing calls this directly
no test coverage detected