-
Notifications
You must be signed in to change notification settings - Fork 736
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?
Conversation
It takes the default_branch_only parameter into account. Tests still fail.
Still fails.
…tions and add @nullable annotations for optional parameters
* 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 comment
The reason will be displayed to describe this comment to others. Learn more.
Take a look at the test for forkTo()
:
github-api/src/test/java/org/kohsuke/github/AppTest.java
Lines 693 to 697 in 58dcca1
@Test | |
public void testOrgFork() throws Exception { | |
cleanupRepository(GITHUB_API_TEST_ORG + "/rubywm"); | |
gitHub.getRepository("kohsuke/rubywm").forkTo(gitHub.getOrganization(GITHUB_API_TEST_ORG)); | |
} |
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 .
Solid start on this. Made some suggestions. Happy to discuss further. Please ask if you have questions. |
/** | ||
* Creates a fork of this repository with optional parameters. | ||
* | ||
* @param organization | ||
* the organization to fork to, or null to fork to the authenticated user's account | ||
* @param name | ||
* the name of the new repository, or null to use the same name as the original repository | ||
* @param defaultBranchOnly | ||
* whether to fork only the default branch | ||
* @return the newly forked repository | ||
* @throws IOException | ||
* if an I/O error occurs | ||
*/ | ||
public GHRepository createFork(@Nullable String organization, @Nullable String name, boolean defaultBranchOnly) | ||
throws IOException { |
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!
First attempt at fixing issue #1993.
I'm aware that the tests aren't passing. 🤷 Implementing them involved a series of unsuccessful guesses. That's also why I attempted to add some configuration for the mocking part, but unfortunately, it didn't work out.
I hope my use of
@Deprecated(forRemoval = true)
wasn't too extreme. 🤞Description
New Features
Bug Fixes
Tests
Chores
Before submitting a PR:
@link
JavaDoc entries to the relevant documentation on https://docs.github.com/en/rest .mvn -D enable-ci clean install site
locally. If this command doesn't succeed, your change will not pass CI.main
. You will create your PR from that branch.When creating a PR: