Skip to content

Commit 6eea04d

Browse files
authored
Merge pull request #91 from ShaneMalachow/main
Authenticate to GitHub Enterprise Server instances
2 parents 8a52b69 + c567611 commit 6eea04d

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

Diff for: issue_metrics.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,12 @@ def auth_to_github() -> github3.GitHub:
121121
github3.GitHub: A github api connection.
122122
"""
123123
if token := os.getenv("GH_TOKEN"):
124-
github_connection = github3.login(token=token)
124+
if not os.getenv("GITHUB_SERVER_URL"):
125+
github_connection = github3.login(token=token)
126+
elif os.getenv("GITHUB_SERVER_URL") == 'https://github.com':
127+
github_connection = github3.login(token=token)
128+
else:
129+
github_connection = github3.GitHubEnterprise(os.getenv("GITHUB_SERVER_URL"),token=token)
125130
else:
126131
raise ValueError("GH_TOKEN environment variable not set")
127132

0 commit comments

Comments
 (0)