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 type: 'check' as const,
283 name: context.name,
284 status: normalizeGithubCheckState(context.conclusion, context.status),
285 });
286 break;
287 case 'StatusContext':
288 statusMap.set(`status:${context.context!}`, {
289 type: 'status' as const,
290 name: context.context!,
291 status: normalizeGithubStatusState(context.state!),
292 ...(context.description ? {description: context.description} : {}),
293 });
294 break;
295 }
296 });
297
298 return {
299 combinedStatus: normalizeGithubStatusState(statusCheckRollup.state),
300 statuses: Array.from(statusMap.values()),
301 };
302}
303
304/** Retrieve the normalized PullRequestStatus for the provided github status state. */
305function normalizeGithubStatusState(state: StatusState): PullRequestStatus {
306 switch (state) {
307 case 'FAILURE':
308 case 'ERROR':
309 return PullRequestStatus.FAILING;

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected