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

Function handler

ng-dev/perf/workflow/cli.ts:48–82  ·  view source on GitHub ↗

Handles the checkout pull request command.

({configFile, list, name, commitSha}: WorkflowsParams)

Source from the content-addressed store, hash-verified

46
47/** Handles the checkout pull request command. */
48async function handler({configFile, list, name, commitSha}: WorkflowsParams) {
49 const workflows = await loadWorkflows(join(determineRepoBaseDirFromCwd(), configFile));
50
51 if (list) {
52 process.stdout.write(JSON.stringify(Object.keys(workflows)));
53 return;
54 }
55
56 const results: {name: string; value: number}[] = [];
57
58 if (name) {
59 const {value} = await measureWorkflow(workflows[name]);
60 results.push({value, name});
61 } else {
62 for (const workflow of Object.values(workflows)) {
63 const {name, value} = await measureWorkflow(workflow);
64 results.push({value, name});
65 }
66 }
67
68 if (commitSha) {
69 const spinner = new Spinner('Uploading performance results to database');
70 try {
71 for (let {value, name} of results) {
72 await addWorkflowPerformanceResult({
73 name,
74 value,
75 commit_sha: commitSha,
76 });
77 }
78 } finally {
79 spinner.success('Upload complete');
80 }
81 }
82}
83
84/** yargs command module for checking out a PR. */
85export const WorkflowsModule: CommandModule<{}, WorkflowsParams> = {

Callers

nothing calls this directly

Calls 9

successMethod · 0.95
loadWorkflowsFunction · 0.85
measureWorkflowFunction · 0.85
writeMethod · 0.45
stringifyMethod · 0.45
keysMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected