Skip to content

Commit d4ffcd6

Browse files
committed
fix(ng-dev): allow for temporarily disabling workflows (#2484)
Allow for temporarily disabling workflows from perf tracking PR Close #2484
1 parent 4a7240f commit d4ffcd6

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

ng-dev/perf/workflow/loader.ts

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,32 @@ import {readFile} from 'fs/promises';
22
import {parse} from 'yaml';
33

44
export interface Workflow {
5+
// The friendly name of the workflow.
56
name: string;
7+
// The set of commands to run under timing test for the workflow.
68
workflow: string[];
9+
// The set of commands to run in preparation for the workflow.
710
prepare?: string[];
11+
// The set of commands to run as a cleanup.
812
cleanup?: string[];
13+
// Whether the workflow is temporarily disabled.
14+
disabled?: true;
915
}
1016

1117
export async function loadWorkflows(src: string) {
18+
/** The set of workflows which can be executed. */
19+
const filteredWorkflows: {[key: string]: Workflow} = {};
20+
/** The workflow configuration file content as a string. */
1221
const rawWorkflows = await readFile(src, {encoding: 'utf-8'});
13-
return parse(rawWorkflows).workflows as {[key: string]: Workflow};
22+
/** The object parsed from the workflow configuration file, holding the workflow configurations. */
23+
const workflows = parse(rawWorkflows).workflows as {[key: string]: Workflow};
24+
25+
// Remove any workflow which is marked as disabled.
26+
for (const [name, workflow] of Object.entries(workflows)) {
27+
if (workflow.disabled !== true) {
28+
filteredWorkflows[name] = workflow;
29+
}
30+
}
31+
32+
return filteredWorkflows;
1433
}

0 commit comments

Comments
 (0)