Parse reusable workflows up to a depth of 1

This commit is contained in:
Josh Gross
2023-02-06 15:10:34 -05:00
parent b9a01ed5aa
commit 13aaa381c8
22 changed files with 356 additions and 183 deletions
@@ -8,12 +8,16 @@ const nullTrace: TraceWriter = {
error: x => {}
};
export function createWorkflowContext(workflow: string, job?: string, stepIndex?: number): WorkflowContext {
export async function createWorkflowContext(
workflow: string,
job?: string,
stepIndex?: number
): Promise<WorkflowContext> {
const parsed = parseWorkflow({name: "test.yaml", content: workflow}, nullTrace);
if (!parsed.value) {
throw new Error("Failed to parse workflow");
}
const template = convertWorkflowTemplate(parsed.context, parsed.value);
const template = await convertWorkflowTemplate(parsed.context, parsed.value);
const context: WorkflowContext = {uri: "test.yaml", template};
if (job) {