Merge pull request #707 from cli/stale-check-conclusion
Prevent crash when encountering "STALE" check conclusion
This commit is contained in:
commit
d4692c3ad9
2 changed files with 6 additions and 4 deletions
|
|
@ -22,7 +22,9 @@ func TestPullRequest_ChecksStatus(t *testing.T) {
|
|||
{ "status": "COMPLETED",
|
||||
"conclusion": "FAILURE" },
|
||||
{ "status": "COMPLETED",
|
||||
"conclusion": "ACTION_REQUIRED" }
|
||||
"conclusion": "ACTION_REQUIRED" },
|
||||
{ "status": "COMPLETED",
|
||||
"conclusion": "STALE" }
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
@ -32,8 +34,8 @@ func TestPullRequest_ChecksStatus(t *testing.T) {
|
|||
eq(t, err, nil)
|
||||
|
||||
checks := pr.ChecksStatus()
|
||||
eq(t, checks.Total, 7)
|
||||
eq(t, checks.Pending, 2)
|
||||
eq(t, checks.Total, 8)
|
||||
eq(t, checks.Pending, 3)
|
||||
eq(t, checks.Failing, 3)
|
||||
eq(t, checks.Passing, 2)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -120,7 +120,7 @@ func (pr *PullRequest) ChecksStatus() (summary PullRequestChecksStatus) {
|
|||
summary.Passing++
|
||||
case "ERROR", "FAILURE", "CANCELLED", "TIMED_OUT", "ACTION_REQUIRED":
|
||||
summary.Failing++
|
||||
case "EXPECTED", "REQUESTED", "QUEUED", "PENDING", "IN_PROGRESS":
|
||||
case "EXPECTED", "REQUESTED", "QUEUED", "PENDING", "IN_PROGRESS", "STALE":
|
||||
summary.Pending++
|
||||
default:
|
||||
panic(fmt.Errorf("unsupported status: %q", state))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue