MCPcopy Index your code
hub / github.com/21st-dev/1code / computeChecksStatus

Function computeChecksStatus

src/main/lib/git/github/github.ts:201–230  ·  view source on GitHub ↗
(
	rollup: GHPRResponse["statusCheckRollup"],
)

Source from the content-addressed store, hash-verified

199}
200
201function computeChecksStatus(
202 rollup: GHPRResponse["statusCheckRollup"],
203): NonNullable<GitHubStatus["pr"]>["checksStatus"] {
204 if (!rollup || rollup.length === 0) {
205 return "none";
206 }
207
208 let hasFailure = false;
209 let hasPending = false;
210
211 for (const ctx of rollup) {
212 // StatusContext uses 'state', CheckRun uses 'conclusion'
213 const status = ctx.state || ctx.conclusion;
214
215 if (status === "FAILURE" || status === "ERROR" || status === "TIMED_OUT") {
216 hasFailure = true;
217 } else if (
218 status === "PENDING" ||
219 status === "" ||
220 status === null ||
221 status === undefined
222 ) {
223 hasPending = true;
224 }
225 }
226
227 if (hasFailure) return "failure";
228 if (hasPending) return "pending";
229 return "success";
230}

Callers 1

getPRForBranchFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected