Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion pkg/commit/commit.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ type CommitOptions struct {
RetryBackoff time.Duration
PullRequestSourceBranchName string
PullRequestBody string
MergeMethod string
}

func CreateCommit(ctx context.Context, client *github.Client, options *CommitOptions) error {
Expand Down Expand Up @@ -133,8 +134,12 @@ func CreateCommit(ctx context.Context, client *github.Client, options *CommitOpt
return err
}

prOpts := &github.PullRequestOptions{
MergeMethod: options.MergeMethod,
}

for retryCount := 1; retryCount <= options.MaxRetries; retryCount++ {
_, res, err := client.PullRequests.Merge(ctx, options.RepoOwner, options.RepoName, pr.GetNumber(), commit.GetMessage(), nil)
_, res, err := client.PullRequests.Merge(ctx, options.RepoOwner, options.RepoName, pr.GetNumber(), commit.GetMessage(), prOpts)
if err == nil {
// PR was merged, so we can attempt to remove our working branch.
// This isn't a critical operation, hence we do not error out if we fail to do so.
Expand Down