-
-
Notifications
You must be signed in to change notification settings - Fork 14
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
fetch script: unclear error message with invalid GITHUB_TOKEN
#38
Comments
The Here's the diff: < readonly LATEST='https://api.github.com/repos/exercism/configlet/releases/latest'
> readonly LATEST='https://api.github.com/repos/exercism/canonical-data-syncer/releases/latest'
< FILENAME="configlet-${OS}-${ARCH}.${EXT}"
> FILENAME="canonical_data_syncer-${OS}-${ARCH}.${EXT}"
< curl --header "$HEADER" -s --location "$URL" -o bin/latest-configlet.zip
< unzip bin/latest-configlet.zip -d bin/
< rm bin/latest-configlet.zip
> curl --header "$HEADER" -s --location "$URL" -o bin/latest-canonical_data_syncer.zip
> unzip bin/latest-canonical_data_syncer.zip -d bin/
> rm bin/latest-canonical_data_syncer.zip So if there's something wrong here then we should change Just for any others reading, here are the relevant lines: I've tested that the script works for me without
seems to work for me too. See #174 for the PR that added the Perhaps you have a bad If not, maybe:
|
I updated my version of fetch-configlet to this one you linked to and now it too fails like fetch-canonical_data_syncer - so there is at least consistency. |
I suspect that you have a bad #!/bin/bash
readonly LATEST='https://api.github.com/repos/exercism/canonical-data-syncer/releases/latest'
GITHUB_TOKEN="my_invalid_token"
HEADER="authorization: Bearer ${GITHUB_TOKEN}"
echo "Sending HEADER of '${HEADER}'"
curl --header "$HEADER" -s "$LATEST" I see the output:
that is, I see the same response as you. Questions:
if [ -z "${GITHUB_TOKEN}" ]
then
HEADER=''
+ echo "HEADER is the empty string"
else
HEADER="authorization: Bearer ${GITHUB_TOKEN}"
+ echo "HEADER contains token"
fi If you have a bad token defined then the behaviour you're seeing is the currently expected behaviour. We could potentially add some code that falls back to an unauthenticated request if the authenticated one fails with
but that has the potential to use unauthenticated requests during CI, in which case we could start seeing mysterious CI failures again. |
Definitely appears to be User Error. I had a GITHUB_TOKEN set on this machine - not sure why or what it was for. I have corrected that (by, for now, setting it to a valid token) and fetch-configlet and fetch-canonical_data_syncer both work correctly. Thank you for your time. I will close this issue. |
Maybe we can add to the script to run this (only in case of an error):
Might be an easy, nice to have, user improvement. |
Wouldn't that expose the token in CI scenarios? |
No problem. You're welcome.
Yes, it would. But there's still probably some way to improve the ergonomics in this case. I'll open an issue to track this in the |
GITHUB_TOKEN
The script was not downloading the binary and exiting with non-zero exit code. Some quick debuging showed that
$URL
was an empty string. Then I checked whatcurl --header "$HEADER" -s "$LATEST"
(as on line 38) output and saw:Removing
--header "$HEADER"
fixes the immediate issue and now I have a binary.However before putting in a PR for this I'd like to know if this is an actual fix or just a workaround and tha the real problem may be elsewhere.
The text was updated successfully, but these errors were encountered: