Skip to content

Conversation

@dhruvmanila
Copy link
Contributor

@dhruvmanila dhruvmanila commented Dec 18, 2020

  • Add missing attributes in the Installation object
  • Add get_installation_by_id() method in the Main class (tested locally)
  • Move GithubIntegration.get_installation() to Github.get_installation_by_repo() (tested locally)
  • Update docstring for the mentioned methods
  • Add test for Installation object attributes
  • Add test for Github.get_installation_by_id()
  • Add test for Github.get_installation_by_repo()

Also, the Installation.get_repos() method should be moved to the main class as Github.get_installation_repos() because that method requires an installation access token and also the Installation object is NonCompletableGithubObject.

Fixes: #1781
Fixes: #1776

@codecov-io
Copy link

codecov-io commented Dec 18, 2020

Codecov Report

Merging #1791 (c7531b5) into master (f299699) will increase coverage by 0.09%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1791      +/-   ##
==========================================
+ Coverage   98.76%   98.86%   +0.09%     
==========================================
  Files          51       50       -1     
  Lines        2677     2636      -41     
==========================================
- Hits         2644     2606      -38     
+ Misses         33       30       -3     
Impacted Files Coverage Δ
github/MainClass.py 95.68% <100.00%> (+0.05%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f299699...c7531b5. Read the comment docs.

"""
return self._updated_at.value

def get_repos(self):
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also don't think this method belongs in the Installation object as that is a NonCompletable and also the API call does not depend on any of the Installation attributes. It should be moved to the github.Github.get_installation_repos.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That would be nice, particularly if you only have an installation token and are not generating one. This is what happens in Github Actions.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Class github.Github is already cluttered with lots of class specific methods.

Why is Github.get_installation_repos better than installation.get_repos? With the latter it is clear that this requires an installation auth, while Github can be used with lots of different authentications, but that method works only with an installation auth.

@dhruvmanila dhruvmanila marked this pull request as ready for review December 18, 2020 09:38
@dhruvmanila
Copy link
Contributor Author

@s-t-e-v-e-n-k Hey, can you take a look at this? Thanks.

@dhruvmanila dhruvmanila changed the title [WIP]: Update Installation object with attributes and related methods Update Installation object with attributes and related methods Dec 23, 2020
Copy link
Collaborator

@s-t-e-v-e-n-k s-t-e-v-e-n-k left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My biggest concern with this is it is breaks all users of Installation since it pretty much rewrites it. Can you see any sort of migration plan here?

@codecov-commenter
Copy link

codecov-commenter commented May 29, 2021

Codecov Report

Merging #1791 (729453c) into master (d1644e3) will increase coverage by 0.00%.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1791   +/-   ##
=======================================
  Coverage   98.85%   98.86%           
=======================================
  Files         108      108           
  Lines       11064    11141   +77     
=======================================
+ Hits        10937    11014   +77     
  Misses        127      127           
Impacted Files Coverage Δ
.../runner/work/PyGithub/PyGithub/github/MainClass.py 94.73% <0.00%> (-0.52%) ⬇️
...nner/work/PyGithub/PyGithub/github/Installation.py 99.11% <0.00%> (+5.78%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d1644e3...729453c. Read the comment docs.

@dhruvmanila dhruvmanila force-pushed the fix-installation-obj branch from 579aa3c to 407856a Compare May 29, 2021 05:37
@dhruvmanila
Copy link
Contributor Author

My biggest concern with this is it is breaks all users of Installation since it pretty much rewrites it. Can you see any sort of migration plan here?

I will restore the method in GithubIntegration class which will emit a deprecation warning and will use the updated method in the main class. I think that's the only method which will be deprecated and about bringing back the get_installation(id) from #1776 the name has been changed from get_installation to get_installation_by_id to avoid conflicts with the updated method get_installation_by_repo.

@stale
Copy link

stale bot commented Jan 8, 2022

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.

@stale stale bot added the stale label Jan 8, 2022
@dhruvmanila
Copy link
Contributor Author

Any updates here?

@stale stale bot removed the stale label Jan 9, 2022
@stale
Copy link

stale bot commented Apr 16, 2022

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.

@stale stale bot added the stale label Apr 16, 2022
@dhruvmanila
Copy link
Contributor Author

Is this still relevant or should I close this?

@stale stale bot removed the stale label Apr 16, 2022
@megamorf
Copy link

megamorf commented Jun 1, 2022

I'd like to see this feature implemented as well. I was just in the process of automating the monthly permissions check on our org and was surprised to see that I cannot really query installed apps properly.

headers, data = self.__requester.requestJsonAndCheck("GET", f"/apps/{slug}")
return GithubApp.GithubApp(self.__requester, headers, data, completed=True)

def get_installation_by_id(self, installation_id):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is now implemented by GithubInstallation.get_app_installation(installation_id).

self.__requester, headers, data, completed=True
)

def get_installation_by_repo(self, owner, repo):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is now implemented by GithubIntegration.get_repo_installation(owner, repo).

"""
return self._updated_at.value

def get_repos(self):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Class github.Github is already cluttered with lots of class specific methods.

Why is Github.get_installation_repos better than installation.get_repos? With the latter it is clear that this requires an installation auth, while Github can be used with lots of different authentications, but that method works only with an installation auth.

@dhruvmanila
Copy link
Contributor Author

Honestly, I've actually lost context regarding this. I might need to look at it from scratch to pick it up but I don't want to spend time if it has become irrelevant.

If anyone else wants to continue the work done here, please feel free to do so. I'm happy to help :)

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

Successfully merging this pull request may close these issues.

Way to get all the installed GitHub apps in the org Return MainClass.Github.get_installation(id)

7 participants