(ctx context.Context, gitcmd git.GitInterface, info *github.GitHubInfo, commit git.Commit, prevCommit *git.Commit)
| 410 | } |
| 411 | |
| 412 | func (c *client) CreatePullRequest(ctx context.Context, gitcmd git.GitInterface, |
| 413 | info *github.GitHubInfo, commit git.Commit, prevCommit *git.Commit) *github.PullRequest { |
| 414 | |
| 415 | baseRefName := c.config.Repo.GitHubBranch |
| 416 | if prevCommit != nil { |
| 417 | baseRefName = git.BranchNameFromCommit(c.config, *prevCommit) |
| 418 | } |
| 419 | headRefName := git.BranchNameFromCommit(c.config, commit) |
| 420 | |
| 421 | log.Debug().Interface("Commit", commit). |
| 422 | Str("FromBranch", headRefName).Str("ToBranch", baseRefName). |
| 423 | Msg("CreatePullRequest") |
| 424 | |
| 425 | templatizer := config_fetcher.PRTemplatizer(c.config, gitcmd) |
| 426 | |
| 427 | body := templatizer.Body(info, commit, nil) |
| 428 | resp, err := c.api.CreatePullRequest(ctx, genclient.CreatePullRequestInput{ |
| 429 | RepositoryId: info.RepositoryID, |
| 430 | BaseRefName: baseRefName, |
| 431 | HeadRefName: headRefName, |
| 432 | Title: templatizer.Title(info, commit), |
| 433 | Body: &body, |
| 434 | Draft: &c.config.User.CreateDraftPRs, |
| 435 | }) |
| 436 | check(err) |
| 437 | |
| 438 | pr := &github.PullRequest{ |
| 439 | ID: resp.CreatePullRequest.PullRequest.Id, |
| 440 | Number: resp.CreatePullRequest.PullRequest.Number, |
| 441 | FromBranch: headRefName, |
| 442 | ToBranch: baseRefName, |
| 443 | Commit: commit, |
| 444 | Title: commit.Subject, |
| 445 | Body: resp.CreatePullRequest.PullRequest.Body, |
| 446 | MergeStatus: github.PullRequestMergeStatus{ |
| 447 | ChecksPass: github.CheckStatusUnknown, |
| 448 | ReviewApproved: false, |
| 449 | NoConflicts: false, |
| 450 | Stacked: false, |
| 451 | }, |
| 452 | } |
| 453 | |
| 454 | if c.config.User.LogGitHubCalls { |
| 455 | fmt.Printf("> github create %d : %s\n", pr.Number, pr.Title) |
| 456 | } |
| 457 | |
| 458 | return pr |
| 459 | } |
| 460 | |
| 461 | func (c *client) UpdatePullRequest(ctx context.Context, gitcmd git.GitInterface, |
| 462 | info *github.GitHubInfo, pullRequests []*github.PullRequest, pr *github.PullRequest, |
nothing calls this directly
no test coverage detected