Closed iffy closed 4 years ago
Best way to test this is to update the tester which works around the API limit today.
https://github.com/dom96/choosenim/blob/master/tests/tester.nim#L199
We can add a read-only token to the choosenim CI and see if the build passes.
The env var is the best way for tokens with a CI. However, a file is more appropriate for regular users. See the nimble implementation to see how it deals with this. Might be best to keep choosenim and nimble similar.
https://github.com/nim-lang/nimble/blob/master/src/nimblepkg/publish.nim#L52
I don't know how to build choosenim to test this, so I don't know if it works
nimble build
should work...
nimble build
worked great!
What's the authoritative spec for GITHUB_TOKEN? What does it contain? username:password?
It's an opaque hexadecimal string that can be used as a username in an HTTP request. You can also use it as a Bearer token in an HTTP header. I've added some cli documentation that might make it clearer?
Also, please add some code to show an info message when the token is used.
Done
I'm not sure why this change causes this build failure:
/Users/travis/build/dom96/choosenim/tests/tester.nim(179, 19): Check failed: exitCode == QuitSuccess
exitCode was 1
QuitSuccess was 0
Updating devel
Warning fatal: unable to access 'https://github.com/nim-lang/Nim/': Could not resolve host: github.com
... git ls-remote failed
Downloading Nim devel from GitHub
/Users/travis/build/dom96/choosenim/src/choosenim.nim(299) choosenim
/Users/travis/build/dom96/choosenim/src/choosenim.nim(274) performAction
/Users/travis/build/dom96/choosenim/src/choosenim.nim(166) update
/Users/travis/build/dom96/choosenim/src/choosenim.nim(24) installVersion
/Users/travis/build/dom96/choosenim/src/choosenimpkg/download.nim(282) download
/Users/travis/build/dom96/choosenim/src/choosenimpkg/download.nim(253) downloadImpl
/Users/travis/build/dom96/choosenim/src/choosenimpkg/download.nim(188) downloadFile
/Users/travis/build/dom96/choosenim/src/choosenimpkg/download.nim(152) downloadFileCurl
/Users/travis/build/dom96/choosenim/src/choosenimpkg/download.nim(70) checkCurl
Error: unhandled exception: CURL failed: Couldn't resolve host name [AssertionError]
/Users/travis/build/dom96/choosenim/tests/tester.nim(188, 19): Check failed: exitCode == QuitSuccess
exitCode was 1
QuitSuccess was 0
/Users/travis/build/dom96/choosenim/tests/tester.nim(193, 17): Check failed: inLines(output.processOutput, "latest changes")
/Users/travis/build/dom96/choosenim/tests/tester.nim(194, 17): Check failed: inLines(output.processOutput, "building")
[FAILED] can update devel with git
Restarting the failed job - travis network is flaky sometimes.
This change inserts the value of the env var
GITHUB_TOKEN
into the authentication section of Github API URLs.This is to fix #208
choosenim
to test this, so I don't know if it worksI'm fine if you want to throw this away and do your own implementation.