diff --git a/issue_metrics.py b/issue_metrics.py index 410e028..370b777 100644 --- a/issue_metrics.py +++ b/issue_metrics.py @@ -121,7 +121,12 @@ def auth_to_github() -> github3.GitHub: github3.GitHub: A github api connection. """ if token := os.getenv("GH_TOKEN"): - github_connection = github3.login(token=token) + if not os.getenv("GITHUB_SERVER_URL"): + github_connection = github3.login(token=token) + elif os.getenv("GITHUB_SERVER_URL") == 'https://github.com': + github_connection = github3.login(token=token) + else: + github_connection = github3.GitHubEnterprise(os.getenv("GITHUB_SERVER_URL"),token=token) else: raise ValueError("GH_TOKEN environment variable not set")