Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Add support for repository visibility #1074

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

Merged
merged 9 commits into from
Apr 5, 2021

Conversation

vahrennd
Copy link
Contributor

@vahrennd vahrennd commented Apr 1, 2021

Description

Adds support for the repository "visibility" field - "public" or "private," plus "internal" for Enterprise
Fixes #932

Before submitting a PR:

We love getting PRs, but we hate asking people for the same basic changes every time.

  • Push your changes to a branch other than master. Create your PR from that branch.
  • Add JavaDocs and other comments
  • Write tests that run and pass in CI. See CONTRIBUTING.md for details on how to capture snapshot data.
  • Run mvn -D enable-ci clean install site locally. If this command doesn't succeed, your change will not pass CI.

When creating a PR:

  • Fill in the "Description" above.
  • Enable "Allow edits from maintainers".

@vahrennd
Copy link
Contributor Author

vahrennd commented Apr 1, 2021

I wasn't able to add a JUnit test for "internal" because it's exclusive to GitHub Enterprise, but I did do some manual testing against an enterprise instance:

Screen Shot 2021-04-01 at 9 26 55 AM

@vahrennd vahrennd marked this pull request as ready for review April 1, 2021 17:15
@vahrennd
Copy link
Contributor Author

vahrennd commented Apr 1, 2021

Also, if I can get access to hub4j-test-org I'll update the test snapshots as requested in the contribution instructions if that's preferable.

Comment on lines 101 to 111
private GHVisibility visibility;

Copy link
Member

Choose a reason for hiding this comment

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

We were just having a discussion on another thread as to how to handle enums like this. We settled on a storing them as String and converting when requested to avoid throwing exceptions if new values are ever added.

See b8f00bc

@@ -249,6 +249,27 @@ public void testUpdateRepository() throws Exception {
assertThat(redux.getDescription(), equalTo(updatedDescription));
}

@Test
public void testGetRepositoryWithVisibility() throws IOException {
Copy link
Member

Choose a reason for hiding this comment

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

Definitely want to test the INTERNAL value as well. If you can create a test for it and then manually modify the data , that would be great. After recording, have the test use snapshotNotAllowed(); so no one accidentally deletes that data.

Copy link
Member

@bitwiseman bitwiseman left a comment

Choose a reason for hiding this comment

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

Generally looks good. Please make the tweaks requested and re-record using the hub4j-test-org.
Thanks!

@vahrennd
Copy link
Contributor Author

vahrennd commented Apr 2, 2021

Thanks @bitwiseman, should be ready for another look.

src/main/java/org/kohsuke/github/GHRepository.java Outdated Show resolved Hide resolved
src/main/java/org/kohsuke/github/GHRepository.java Outdated Show resolved Hide resolved
@bitwiseman bitwiseman force-pushed the repository-visibility branch 3 times, most recently from b3eb76f to 08eeea6 Compare April 2, 2021 23:31
@bitwiseman
Copy link
Member

Hm, I have no idea what I did to make this break. I'll look at it tomorrow.

@vahrennd vahrennd force-pushed the repository-visibility branch from 08eeea6 to 99f192d Compare April 4, 2021 11:16
@vahrennd
Copy link
Contributor Author

vahrennd commented Apr 4, 2021

I think this was the issue: https://github.com/hub4j/github-api/pull/1075/files#diff-a57ffc6640b7868f12be28cd63c1587ecbcb58c5551129d51838d8887059139dL61-R67

That change switched from importing all previews to importing specific ones, so I just needed to add NEBULA to the list.

@bitwiseman bitwiseman merged commit 578fe08 into hub4j:master Apr 5, 2021
@vahrennd vahrennd deleted the repository-visibility branch April 5, 2021 12:13
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.

GHRepository's isPrivate() returns true for Internal repositories
3 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.