Skip to content

Commit f04b553

Browse files
change to 403 error status code (#70)
* change to 403 error status code * adding comment
1 parent e35a604 commit f04b553

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

pkg/commenter/github/connector.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@ package github
33
import (
44
"context"
55
"fmt"
6+
"time"
7+
68
"github.com/google/go-github/v44/github"
79
"golang.org/x/oauth2"
8-
"time"
910
)
1011

1112
const githubAbuseErrorRetries = 6
@@ -86,7 +87,9 @@ func writeCommentWithRetries(owner, repo string, prNumber int, commentFn comment
8687
time.Sleep(time.Second * time.Duration(retrySeconds))
8788

8889
if resp, err := commentFn(); err != nil {
89-
if resp != nil && resp.StatusCode == 422 {
90+
// If we get a 403 or 422, we are being rate or abuse limited by GitHub,
91+
// and we want to retry, while increasing the wait time between retries.
92+
if resp != nil && (resp.StatusCode == 422 || resp.StatusCode == 403) {
9093
abuseError = newAbuseRateLimitError(owner, repo, prNumber, retrySeconds)
9194
continue
9295
}

0 commit comments

Comments
 (0)