Skip to content
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

On expired NEIL_GITHUB_TOKEN, neil dep upgrade does nothing, then terminates with exit code 0 #237

Open
teodorlu opened this issue Aug 2, 2024 · 4 comments

Comments

@teodorlu
Copy link
Contributor

teodorlu commented Aug 2, 2024

Observation

When I run neil dep upgrade either from the command line with an expired NEIL_GITHUB_TOKEN, Neil prints error messages, but returns with exit code 0.

$ neil-dev dep upgrade
{"message":"Bad credentials","documentation_url":"https://docs.github.com/rest","status":"401"}
{"message":"Bad credentials","documentation_url":"https://docs.github.com/rest","status":"401"}
$ echo $?
0

Expected behavior

I would expect neil dep upgrade to terminate with a nonzero exit code when nothing happened due to an expired Github token.

Perhaps also give a more helpful description than printing

{"message":"Bad credentials","documentation_url":"https://docs.github.com/rest","status":"401"}

twice, informing the user that their NEIL_GITHUB_TOKEN didn't appear to work.

Extra details

@borkdude
Copy link
Contributor

borkdude commented Aug 2, 2024

sounds good

@teodorlu
Copy link
Contributor Author

teodorlu commented Aug 3, 2024

Perhaps a better alternative could be to print a warning, then retry without authentication.

Preference, @borkdude?

@borkdude
Copy link
Contributor

borkdude commented Aug 3, 2024

sounds good as well!

@teodorlu teodorlu changed the title Exit code 0 on expired NEIL_GITHUB_TOKEN On expired NEIL_GITHUB_TOKEN, neil dep upgrade does nothing, then terminates with exit code 0 Aug 4, 2024
@teodorlu
Copy link
Contributor Author

teodorlu commented Aug 4, 2024

Perhaps a better alternative could be to print a warning, then retry without authentication.

It appears this won't work.

From local testing, invalid Github token works from Github's API. The HTTP request only starts returning non-success HTTP responses after the free usage has been consumed. In other words, retrying won't help, we'll just trigger a different error; not helpful for the user.


I thought of something else that further complicates the issue. With the following deps.edn file, there are both Git deps and Clojars deps:

{:deps {babashka/pods {#_#_:local/root "/Users/borkdude/Dropbox/dev/clojure/babashka/babashka.pods"
                       :git/url "https://github.com/babashka/babashka.pods"
                       :git/sha "47e55fe5e728578ff4dbf7d2a2caf00efea87b1e"}
        io.github.nextjournal/clerk {:mvn/version "0.10.560"}}
 :aliases {}}

Current neil dep upgrade behavior is to "do the things we can": upgrade Clerk to latest, and leave babashka/pods alone because the HTTP request to Github failed.

I don't think changing this behavior to "Neil refuses to do anything because one request to Github failed" is helpful for the user.


Proposed new scope:

  • Add an error message for invalid credentials
  • Leave current exit code behavior as-is.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants