MCPcopy Create free account
hub / github.com/angular/dev-infra / normalizeGithubCheckState

Function normalizeGithubCheckState

ng-dev/pr/common/fetch-pull-request.ts:284–306  ·  view source on GitHub ↗

Retrieve the normalized PullRequestStatus for the provided github check state.

(
  conclusion: CheckConclusionState | null,
  status: CheckStatusState,
)

Source from the content-addressed store, hash-verified

282
283/** Retrieve the normalized PullRequestStatus for the provided github check state. */
284function normalizeGithubCheckState(
285 conclusion: CheckConclusionState | null,
286 status: CheckStatusState,
287): PullRequestStatus {
288 if (status !== 'COMPLETED') {
289 return PullRequestStatus.PENDING;
290 }
291
292 // If the `status` is completed, a conclusion is guaranteed to be set.
293 switch (conclusion!) {
294 case 'ACTION_REQUIRED':
295 case 'TIMED_OUT':
296 case 'CANCELLED':
297 case 'FAILURE':
298 case 'SKIPPED':
299 case 'STALE':
300 case 'STARTUP_FAILURE':
301 return PullRequestStatus.FAILING;
302 case 'SUCCESS':
303 case 'NEUTRAL':
304 return PullRequestStatus.PASSING;
305 }
306}

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected