-
Notifications
You must be signed in to change notification settings - Fork 14
Add GITHUB_TOKEN as another fallback option #148
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -46,13 +46,16 @@ def get_AI_endpoint(): | |
| def get_AI_token(): | ||
| """ | ||
| Get the token for the AI API from the environment. | ||
| The environment variable can be named either AI_API_TOKEN | ||
| or COPILOT_TOKEN. | ||
| The environment variable can be named either AI_API_TOKEN, | ||
| COPILOT_TOKEN, or GITHUB_TOKEN. | ||
| """ | ||
| token = os.getenv("AI_API_TOKEN") | ||
| if token: | ||
| return token | ||
| token = os.getenv("COPILOT_TOKEN") | ||
| if token: | ||
| return token | ||
| token = os.getenv("GITHUB_TOKEN") | ||
| if token: | ||
| return token | ||
| raise RuntimeError("AI_API_TOKEN environment variable is not set.") | ||
|
Comment on lines
46
to
61
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The error message at line 61 only mentions "AI_API_TOKEN environment variable is not set" but the function now accepts three different environment variables (AI_API_TOKEN, COPILOT_TOKEN, or GITHUB_TOKEN). The error message should be updated to reflect all three options to provide accurate guidance to users when none of them are set.