Skip to content

Commit

Permalink
Merge pull request #304 from cpanato/add-retry
Browse files Browse the repository at this point in the history
add retry to create pull request function
  • Loading branch information
k8s-ci-robot committed Jan 23, 2024
2 parents 2b17852 + d40a45b commit 4f37f0c
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions github/github.go
Original file line number Diff line number Diff line change
Expand Up @@ -393,13 +393,12 @@ func (g *githubClient) CreatePullRequest(
MaintainerCanModify: github.Bool(true),
}

pr, _, err := g.PullRequests.Create(ctx, owner, repo, newPullRequest)
if err != nil {
return pr, fmt.Errorf("creating pull request: %w", err)
for shouldRetry := internal.DefaultGithubErrChecker(); ; {
pr, _, err := g.PullRequests.Create(ctx, owner, repo, newPullRequest)
if !shouldRetry(err) {
return pr, err
}
}

logrus.Infof("Successfully created PR #%d", pr.GetNumber())
return pr, nil
}

func (g *githubClient) RequestPullRequestReview(
Expand Down Expand Up @@ -875,6 +874,7 @@ func (g *GitHub) CreatePullRequest(
return pr, err
}

logrus.Infof("Successfully created PR #%d", pr.GetNumber())
return pr, nil
}

Expand Down

0 comments on commit 4f37f0c

Please sign in to comment.