fix(github): readable API errors, normalised webhook review states, no REQUEST_CHANGES on the token's own PR
Errors say what GitHub refused in its own words instead of the request URL and an empty field list. Webhook review states arrive lower-case and were never normalised, so a webhook-delivered change request did not read as one. A review the token would post as REQUEST_CHANGES on its own pull request comments instead, which GitHub accepts. Secondary rate limits wait up to two minutes and retry.
This commit is contained in:
8 files changed
+196
-44
No files matched your search
@@ -15,10 +15,11 @@ func main() {
|
||||
})
|
||||
}
|
||||
|
||||
// normalizeReviewState maps a GitHub review state onto the neutral states.
|
||||
// Unknown states pass through lowercased.
|
||||
// normalizeReviewState maps a GitHub review state onto the neutral states. The
|
||||
// REST API spells states in upper case and webhooks in lower case; unknown
|
||||
// states pass through lowercased.
|
||||
func normalizeReviewState(s string) string {
|
||||
switch s {
|
||||
switch strings.ToUpper(s) {
|
||||
case "APPROVED":
|
||||
return forge.ReviewStateApproved
|
||||
case "CHANGES_REQUESTED":
|
||||
|
||||
Reference in new issue
Block a user