-
Notifications
You must be signed in to change notification settings - Fork 735
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
feat(fork): Fork default branch only #1994
base: main
Are you sure you want to change the base?
Changes from all commits
f750d99
f961ac3
ec41545
97eabee
abfaa1c
f4b02f1
fcb6a72
618b36f
3de3002
43730bf
86ca3f0
3eecab5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -823,6 +823,36 @@ public void ghRepositorySearchBuilderForkDefaultResetForksSearchTerms() { | |||||||||||
assertThat(ghRepositorySearchBuilder.terms.stream().filter(item -> item.contains("fork:")).count(), is(0L)); | ||||||||||||
} | ||||||||||||
|
||||||||||||
/** | ||||||||||||
* Test createFork method with valid parameters. | ||||||||||||
* | ||||||||||||
* @throws IOException | ||||||||||||
* Signals that an I/O exception has occurred. | ||||||||||||
*/ | ||||||||||||
@Test | ||||||||||||
public void testCreateForkWithValidParameters() throws IOException { | ||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Take a look at the test for github-api/src/test/java/org/kohsuke/github/AppTest.java Lines 693 to 697 in 58dcca1
That might help. Note, it uses GITHUB_API_TEST_ORG but you can you a different org while you're trying things out. When you're basically ready, we can re-record the using GITHUB_API_TEST_ORG . |
||||||||||||
String repositoryName = "rubywm"; | ||||||||||||
String upstreamRepositoryOrganization = "kohsuke"; | ||||||||||||
cleanupRepository(GITHUB_API_TEST_ORG + "/" + repositoryName); | ||||||||||||
GHRepository forkedRepository = gitHub.getRepository(upstreamRepositoryOrganization + "/" + repositoryName) | ||||||||||||
.createFork(gitHub.getOrganization(GITHUB_API_TEST_ORG).name, repositoryName, true); | ||||||||||||
assertThat(forkedRepository, notNullValue()); | ||||||||||||
assertThat(forkedRepository.getOwnerName(), equalTo("new-owner")); | ||||||||||||
assertThat(forkedRepository.getName(), equalTo("new-repo")); | ||||||||||||
} | ||||||||||||
|
||||||||||||
/** | ||||||||||||
* Test createFork method with invalid parameters. | ||||||||||||
* | ||||||||||||
* @throws IOException | ||||||||||||
* Signals that an I/O exception has occurred. | ||||||||||||
*/ | ||||||||||||
@Test(expected = IllegalArgumentException.class) | ||||||||||||
public void testCreateForkWithInvalidParameters() throws IOException { | ||||||||||||
GHRepository repository = getRepository(); | ||||||||||||
repository.createFork(null, "", true); | ||||||||||||
} | ||||||||||||
|
||||||||||||
/** | ||||||||||||
* List commit comments some comments. | ||||||||||||
* | ||||||||||||
|
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.
You did basically exactly what I ask for with the deprecations, thanks!
Did you leave out the
public GHRepository createFork()
intentionally or just WIP?If you still plan to provide the method overload with few parameters, the right signature is
public GHRepository createFork(boolean defaultBranchOnly)
instead of no parameters. What are your thoughts?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.
WiP, definitely. I'll work on it, thanks!