INNER CODE UNIT · TypeScript

toWorkflowRun

cloudposse/atmos · .github/actions/stopwatch/src/index.ts:92

function toWorkflowRun(data: ApiWorkflowRun): WorkflowRun {
  return {
    id: data.id,
    workflowId: data.workflow_id,
    name: data.name ?? `Workflow ${data.workflow_id}`,
    event: data.event,
    headSha: data.head_sha,
    status: data.status ?? "unknown",
    conclusion: data.conclusion ?? null,
    createdAt: data.created_at,
    updatedAt: data.updated_at,
    htmlUrl: data.html_url ?? data.url,
    pullRequests: data.pull_requests?.map(({ number }) => ({ number })) ?? [],
  };
}

/** Converts a GitHub workflow-job response to the metrics model. */
function toWorkflowJob(runId: number, data: ApiWorkflowJob): WorkflowJob {

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…