-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Support full GitHub app authentication #1986
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
Support full GitHub app authentication #1986
Conversation
Welcome to Codecov 🎉Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests. Thanks for integrating Codecov - We've got you covered ☂️ |
dblanchette
left a comment
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.
Added some comments for easier reviewing.
| deploymentStatusEnhancementsPreview = "application/vnd.github.flash-preview+json" | ||
|
|
||
|
|
||
| DEFAULT_BASE_URL = "https://api.github.com" |
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.
Moved those here since they are used in 2 files now (MainClass and GithubIntegration)
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.
Comparing this is really difficult. Would have been better to do the refactoring (without changes) in a separate PR and base this PR on that. Then we would see only changes, not moving unchanged code around.
github/GithubException.py
Outdated
| """ | ||
|
|
||
| def __init__(self, status, data, headers): | ||
| def __init__(self, status, data, headers=None): |
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 404 while testing and had an exception because the headers parameters was not passed.
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.
There seems to be a fix there for the same issue: #2079
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 think fixing the calling code as in #2079 is better than changing the signature.
| @@ -0,0 +1,140 @@ | |||
| import time | |||
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.
Moved from MainClass, it's already big as it is and that does not really belong there.
| status=response.status_code, data=response.text | ||
| ) | ||
|
|
||
| @deprecated.deprecated("Use get_repo_installation") |
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.
Let me know if that does not suit you. I feel that this call is badly named
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.
This is the existing call? It should probably also state it's deprecated in the docstring. Also, it should mention the class, not just the bare function.
| def get_repo_installation(self, owner, repo): | ||
| return self.get_installation(owner, repo) | ||
|
|
||
| def get_installations(self): |
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.
This is the part I added in that file. Users having a private app with more than one installations can use this call as the main class always uses the first found installation.
| ): | ||
| self._initializeDebugFeature() | ||
|
|
||
| self.__installation_authorization = None |
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.
The heart of the changes I made is here!
|
also very interested in seeing this implemented, are there any updates on this feature? |
|
Will this be integrated? |
|
@s-t-e-v-e-n-k sorry to ping you directly; there hasn't been any feedback from the maintainers on this PR for close to a month now and I'm not sure who's in charge. What can we do to speed up things and help you out? |
|
Would also really like to see this feature! How can we help? |
|
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
|
Hi, Could you merge this PR? |
|
Would definitely appreciate this feature being merged in |
github/GithubException.py
Outdated
| """ | ||
|
|
||
| def __init__(self, status, data, headers): | ||
| def __init__(self, status, data, headers=None): |
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 think fixing the calling code as in #2079 is better than changing the signature.
|
Thanks for the review! I made the requested changes. |
|
@EnricoMi @ThomasJRyan Anything else I should do? |
|
I went and look at all the files I changed to make sure there were no default values left in pyi. Crossing my fingers that everything is ok now 🤞 |
|
I hate to ask again, but is it all good? I'm looking forward to go back to using the official library instead of our fork. Thanks for your work maintaining this library! |
…on' into feature/github-app-authentication
That is fixed. I must say I find the imports in this project to be done in a peculiar fashion. |
Agreed. I tend to go all out in refactoring as you've seen with the unrelated changes. I'll know to do that in the future. Thank you both for the reviews! |
|
All good now? I'm excited to see this release :) |
|
@dblanchette can you please take a look at #2420 / #2425? |
|
@dblanchette another issue likely being introduced by this PR: #2431 |
|
Another issue: #2432 |
|
This is quite some fallout, another issue reported: #2436 |
This adds support for GitHub App authentication using the main class which is simpler for users (see #1855)
Also, the credentials are refreshed when needed (tokens lasts for one hour). This should happen transparently to the users, as the token expiration is checked at every call.
Caveats and other notes:
GithubIntegration, so I skipped that part. Manual testing works and existing tests are not broken