Skip to content

Commit c0bc938

Browse files
committed
Prevent crash when encountering "STALE" check conclusion
The "STALE" conclusion has shipped this January and is basically a conclusion that can only be reported by GitHub and not explicitly set by any integrations.
1 parent bc3f964 commit c0bc938

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

api/pull_request_test.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@ func TestPullRequest_ChecksStatus(t *testing.T) {
2222
{ "status": "COMPLETED",
2323
"conclusion": "FAILURE" },
2424
{ "status": "COMPLETED",
25-
"conclusion": "ACTION_REQUIRED" }
25+
"conclusion": "ACTION_REQUIRED" },
26+
{ "status": "COMPLETED",
27+
"conclusion": "STALE" }
2628
]
2729
}
2830
}
@@ -32,8 +34,8 @@ func TestPullRequest_ChecksStatus(t *testing.T) {
3234
eq(t, err, nil)
3335

3436
checks := pr.ChecksStatus()
35-
eq(t, checks.Total, 7)
36-
eq(t, checks.Pending, 2)
37+
eq(t, checks.Total, 8)
38+
eq(t, checks.Pending, 3)
3739
eq(t, checks.Failing, 3)
3840
eq(t, checks.Passing, 2)
3941
}

api/queries_pr.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ func (pr *PullRequest) ChecksStatus() (summary PullRequestChecksStatus) {
120120
summary.Passing++
121121
case "ERROR", "FAILURE", "CANCELLED", "TIMED_OUT", "ACTION_REQUIRED":
122122
summary.Failing++
123-
case "EXPECTED", "REQUESTED", "QUEUED", "PENDING", "IN_PROGRESS":
123+
case "EXPECTED", "REQUESTED", "QUEUED", "PENDING", "IN_PROGRESS", "STALE":
124124
summary.Pending++
125125
default:
126126
panic(fmt.Errorf("unsupported status: %q", state))

0 commit comments

Comments
 (0)