Closed lingjie00 closed 6 months ago
Can we name it something other than GITHUB_TOKEN? That's a common environment variable name used by other programs.
Edit: Or is it that by default, GITHUB_TOKEN also works for Copilot's API?
Can we name it something other than GITHUB_TOKEN? That's a common environment variable name used by other programs.
Initially I was thinking to re-use the GITHUB_TOKEN already in the environment. Do you think we should let user to maybe choose the variable in config while setting the default as GITHUB_TOKEN?
Edit: I think by default GITHUB_TOKEN will only work for Copilot if the environment is in CODESPACE. It's interesting that in CODESPACE Github's Neovim Copilot doesn't require login.
It definitely should not be configurable imo, we should just follow whatever github does. Which means we should also check for the CODESPACE env variable like the copilot.vim does probably.
And GITHUB_TOKEN is just API token normally and we are accessing github API so yea it should work as replacement for hosts file.
It definitely should not be configurable imo, we should just follow whatever github does. Which means we should also check for the CODESPACE env variable like the copilot.vim does probably.
And GITHUB_TOKEN is just API token normally and we are accessing github API so yea it should work as replacement for hosts file.
very clear, I've modified to only refer to GITHUB_TOKEN if there is also CODESPACES variable (which indicates we are in GH CODESPACES).
@all-contributors add @lingjie00 for code.
@jellydn
I've put up a pull request to add @lingjie00! :tada:
The copilot module now first tries to load the GitHub token from the environment variable 'GITHUB_TOKEN'. If the variable is not set, it falls back to loading the token from the file.