diff --git a/internal/autoupdate/queue.go b/internal/autoupdate/queue.go index 415e4a21..f5a83d1f 100644 --- a/internal/autoupdate/queue.go +++ b/internal/autoupdate/queue.go @@ -500,8 +500,8 @@ func (q *queue) updatePR(ctx context.Context, pr *PullRequest) { logfields.ReviewDecision(status.ReviewDecision), logfields.StatusCheckRollupState(status.StatusCheckRollupState), ) - if status.ReviewDecision != githubclt.ReviewDecisionApproved { + if status.ReviewDecision != githubclt.ReviewDecisionApproved { if err := q.Suspend(pr.Number); err != nil { logger.Error( "suspending PR because it is not approved, failed", diff --git a/internal/githubclt/client.go b/internal/githubclt/client.go index 30f25bc3..e7307854 100644 --- a/internal/githubclt/client.go +++ b/internal/githubclt/client.go @@ -369,7 +369,7 @@ var graphQlHTTPStatusErrRe = regexp.MustCompile(`^non-200 OK status code: ([0-9] func (clt *Client) wrapGraphQLRetryableErrors(err error) error { matches := graphQlHTTPStatusErrRe.FindStringSubmatch(err.Error()) if len(matches) != 2 { - return nil + return err } errcode, atoiErr := strconv.Atoi(matches[1]) diff --git a/internal/githubclt/client_test.go b/internal/githubclt/client_test.go index 4b7da72f..c3e0d8c4 100644 --- a/internal/githubclt/client_test.go +++ b/internal/githubclt/client_test.go @@ -2,6 +2,7 @@ package githubclt import ( "context" + "errors" "net/http" "net/http/httptest" "testing" @@ -37,3 +38,9 @@ func TestWrapRetryableErrorsGraphql(t *testing.T) { var retryableErr *goorderr.RetryableError assert.ErrorAs(t, err, &retryableErr) } + +func TestWrapRetryableErrorsGraphqlWithNonStatusErr(t *testing.T) { + err := errors.New("error") + wrappedErr := (&Client{}).wrapGraphQLRetryableErrors(err) + assert.Equal(t, err, wrappedErr) +}