-
Notifications
You must be signed in to change notification settings - Fork 6
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
Feature/init command #273
base: develop
Are you sure you want to change the base?
Feature/init command #273
Conversation
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.
I had a quick first look at this and wrote some comments. :-)
Some more that don't fit in the code:
- The Zenodo oauth application says "Application 'hermes-init-oauth' by '' wants permission to access your '[email protected]' account." It would be nice if this was the hermes mailbox address instead of your private one.
- The same for GitHub which currently says "hermes-init-oauth by nheeb". Maybe the softwarepub group can be used here?
- During GitHub OAuth, I run into an error. Afterwards the CLI was stuck.
An error occurred during execution of init
ERROR:hermes.cli:An error occurred during execution of init
DEBUG:hermes.cli:Original exception was: Failed to retrieve public key: 404 {"message":"Not Found","documentation_url":"https://docs.github.com/rest/actions/secrets#get-a-repository-public-key","status":"404"}
Unfortunately, I'm clueless about OAuth, so I have no idea what is going wrong.
Oh I see. I got a 404 because I gave a random git remote URI that doesn't exist but the code actually accesses my repo. 🤦🏻♂️ |
Co-authored-by: David Pape <[email protected]>
Co-authored-by: David Pape <[email protected]>
Co-authored-by: David Pape <[email protected]>
Co-authored-by: David Pape <[email protected]>
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.
Overall this is a very good start. I agree with all of the points from @zyzzyxdonta and added some more 🙈
@nheeb I also noticed flake8 is unhappy. You can execute it locally using poetry run task flake8
with our configuration.
src/hermes/commands/init/base.py
Outdated
if line.startswith("*"): | ||
info.current_branch = line.split()[1].strip() | ||
break | ||
info.uses_github = "github" in info.git_remote_url |
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.
info.git_remote_url.startswith("https://github.com")
would be safest (or use urlparse
and check netloc == "github.com"
).
import hermes.commands.init.slim_click as sc | ||
|
||
|
||
class HermesInitFolderInfo: |
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.
I don't have a strong opinion on where this class should be. However, I would make it a dataclass if it doesn't have any functionality.
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.
Overall, I think this looks pretty good. Just some small suggestions, nothing critical.
I'm still not happy with the oauth client details in the code because malicious actors might reuse them for their activities and they would show up as "hermes" when logging in. But if this is the only way to do it, then I guess there's no choice 🤷🏻♂️
The init command is now working with Oauth. Zenodo Oauth saves the refresh token in the secret and deposit can now use a refresh token to get an access token.