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

Add support for the 'visibility' attribute on the Repository object #1872

Merged
merged 2 commits into from Nov 1, 2021

Conversation

lightningboltemoji
Copy link
Contributor

@lightningboltemoji lightningboltemoji commented Mar 11, 2021

Adds support for the 'visibility' attribute on the Repository object. Closes #1446.

I updated the affected replay tests manually (not seeing a BeaverSoftware org?). I added the header to reflect the new request we'll send, and added "visibility":"public" next to "private":false in all response objects.

I also smoke tested this against our real enterprise account:

$ python3
Python 3.9.1 (default, Jan 30 2021, 15:51:05) 
[Clang 12.0.0 (clang-1200.0.32.29)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import github
>>> g = github.Github("<token>")
>>> repos = list(g.get_organization("my-enterprise").get_repos())
>>> repos[0].private
False
>>> repos[0].visibility
'public'
>>> repos[10].private
True
>>> repos[10].visibility
'internal'
>>> g.get_organization("my-enterprise").get_repo("my-repo").private
True
>>> g.get_organization("my-enterprise").get_repo("my-repo").visibility
'internal'
>>> g.get_organization("my-enterprise").create_repo(name="quick-test", visibility="internal")
Repository(full_name="my-enterprise/quick-test")
# verified this is internal
>>> g.get_organization("my-enterprise").create_repo(name="quick-test-2", private=True)
Repository(full_name="my-enterprise/quick-test-2")
# verified this is private

Thank you for the useful library and taking the time to consider this contribution!

@codecov-io
Copy link

Codecov Report

Merging #1872 (75fff25) into master (aa24030) will decrease coverage by 0.01%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1872      +/-   ##
==========================================
- Coverage   98.87%   98.86%   -0.02%     
==========================================
  Files         108      108              
  Lines       11044    11055      +11     
==========================================
+ Hits        10920    10929       +9     
- Misses        124      126       +2     
Impacted Files Coverage Δ
...runner/work/PyGithub/PyGithub/github/Repository.py 97.28% <0.00%> (-0.12%) ⬇️
...ome/runner/work/PyGithub/PyGithub/github/Consts.py 100.00% <0.00%> (ø)
...nner/work/PyGithub/PyGithub/github/Organization.py 98.56% <0.00%> (+<0.01%) ⬆️

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 aa24030...75fff25. Read the comment docs.

@s-t-e-v-e-n-k
Copy link
Collaborator

Rebase on master, please -- I've deleted those files that are conflicting.

@lightningboltemoji
Copy link
Contributor Author

Hi @s-t-e-v-e-n-k, I've rebased on top of master

@sfdc-afraley
Copy link

Any ETA on getting this merged and released?

@codecov-commenter
Copy link

Codecov Report

Merging #1872 (e12d559) into master (b10dbe3) will decrease coverage by 0.01%.
The diff coverage is n/a.

❗ Current head e12d559 differs from pull request most recent head 178e23d. Consider uploading reports for the commit 178e23d to get more accurate results
Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1872      +/-   ##
==========================================
- Coverage   98.86%   98.84%   -0.02%     
==========================================
  Files         108      108              
  Lines       11064    11071       +7     
==========================================
+ Hits        10938    10943       +5     
- Misses        126      128       +2     
Impacted Files Coverage Δ
github/PullRequestComment.py
github/StatsContributor.py
github/Comparison.py
github/Branch.py
github/GitCommit.py
github/Stargazer.py
github/SourceImport.py
github/GitTree.py
github/Authorization.py
github/TeamDiscussion.py
... and 203 more

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 b10dbe3...178e23d. Read the comment docs.

@s-t-e-v-e-n-k
Copy link
Collaborator

Does this also require changes to MainClass.get_repo to add in the Accept header?

@s-t-e-v-e-n-k
Copy link
Collaborator

Does this also require changes to MainClass.get_repo to add in the Accept header?

It does not, I have checked.

@s-t-e-v-e-n-k s-t-e-v-e-n-k merged commit 8d1397a into PyGithub:master Nov 1, 2021
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.

Support new 'visibility' field of Repository
5 participants