Skip to content

Commit

Permalink
add retry for create pull request
Browse files Browse the repository at this point in the history
Signed-off-by: cpanato <[email protected]>
  • Loading branch information
cpanato committed Jan 23, 2024
1 parent 2b17852 commit d40a45b
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 d40a45b

Please sign in to comment.