mirror of
https://github.com/johndoe6345789/AutoMetabuilder.git
synced 2026-05-06 19:49:38 +00:00
f395031366
Co-authored-by: johndoe6345789 <224850594+johndoe6345789@users.noreply.github.com>
20 lines
682 B
Python
20 lines
682 B
Python
"""GitHub integration builder."""
|
|
import logging
|
|
from .github_integration import GitHubIntegration, get_repo_name_from_env
|
|
|
|
logger = logging.getLogger("autometabuilder")
|
|
|
|
|
|
def create_github_integration(token: str, msgs: dict):
|
|
"""Create GitHub integration if possible."""
|
|
if not token:
|
|
return None
|
|
try:
|
|
repo_name = get_repo_name_from_env()
|
|
gh = GitHubIntegration(token, repo_name)
|
|
logger.info(msgs["info_integrated_repo"].format(repo_name=repo_name))
|
|
return gh
|
|
except Exception as error: # pylint: disable=broad-exception-caught
|
|
logger.warning(msgs["warn_github_init_failed"].format(error=error))
|
|
return None
|