X Tutup
Skip to content

Commit 05c7c2b

Browse files
committed
Treat unrecognized PR Checks statuses as "pending"
Previously, unrecognized Checks statuses would crash the program. For the sake of supporting the "WAITING" status and for forward-compatibility, this treats any unrecognized status as "pending".
1 parent 23b2594 commit 05c7c2b

File tree

2 files changed

+2
-6
lines changed

2 files changed

+2
-6
lines changed

api/queries_pr.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -188,10 +188,8 @@ func (pr *PullRequest) ChecksStatus() (summary PullRequestChecksStatus) {
188188
summary.Passing++
189189
case "ERROR", "FAILURE", "CANCELLED", "TIMED_OUT", "ACTION_REQUIRED":
190190
summary.Failing++
191-
case "EXPECTED", "REQUESTED", "QUEUED", "PENDING", "IN_PROGRESS", "STALE":
191+
default: // "EXPECTED", "REQUESTED", "WAITING", "QUEUED", "PENDING", "IN_PROGRESS", "STALE"
192192
summary.Pending++
193-
default:
194-
panic(fmt.Errorf("unsupported status: %q", state))
195193
}
196194
summary.Total++
197195
}

pkg/cmd/pr/checks/checks.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,13 +141,11 @@ func checksRun(opts *ChecksOptions) error {
141141
markColor = cs.Red
142142
failing++
143143
bucket = "fail"
144-
case "EXPECTED", "REQUESTED", "QUEUED", "PENDING", "IN_PROGRESS", "STALE":
144+
default: // "EXPECTED", "REQUESTED", "WAITING", "QUEUED", "PENDING", "IN_PROGRESS", "STALE"
145145
mark = "-"
146146
markColor = cs.Yellow
147147
pending++
148148
bucket = "pending"
149-
default:
150-
panic(fmt.Errorf("unsupported status: %q", state))
151149
}
152150

153151
elapsed := ""

0 commit comments

Comments
 (0)
X Tutup