fork default branch only in pr create

This commit is contained in:
William Martin 2026-02-12 16:56:14 +01:00
parent 4e65637471
commit 7448aed8ab
2 changed files with 5 additions and 3 deletions

View file

@ -1128,7 +1128,7 @@ func handlePush(opts CreateOptions, ctx CreateContext) error {
forkableRefs, requiresFork := refs.(forkableRefs)
if requiresFork {
opts.IO.StartProgressIndicator()
forkedRepo, err := api.ForkRepo(ctx.Client, forkableRefs.BaseRepo(), "", "", false)
forkedRepo, err := api.ForkRepo(ctx.Client, forkableRefs.BaseRepo(), "", "", true)
opts.IO.StopProgressIndicator()
if err != nil {
return fmt.Errorf("error forking repo: %w", err)

View file

@ -894,11 +894,13 @@ func Test_createRun(t *testing.T) {
httpmock.StringResponse(`{"data": {"viewer": {"login": "monalisa"} } }`))
reg.Register(
httpmock.REST("POST", "repos/OWNER/REPO/forks"),
httpmock.StatusStringResponse(201, `
httpmock.RESTPayload(201, `
{ "node_id": "NODEID",
"name": "REPO",
"owner": {"login": "monalisa"}
}`))
}`, func(payload map[string]interface{}) {
assert.Equal(t, true, payload["default_branch_only"])
}))
reg.Register(
httpmock.GraphQL(`mutation PullRequestCreate\b`),
httpmock.GraphQLMutation(`