Skip to content

Commit b868250

Browse files
committed
Render templates using env before dereferencing
Allows using `${{ env.anything }}` in `$ref`s. See stepci/stepci#220 for a use case explanation.
1 parent df1e528 commit b868250

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

src/index.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,8 +202,10 @@ function renderObject<T extends object>(
202202

203203
// Run from test file
204204
export async function runFromYAML(yamlString: string, options?: WorkflowOptions): Promise<WorkflowResult> {
205-
const workflow = yaml.load(yamlString)
206-
const dereffed = await $RefParser.dereference(workflow as any, {
205+
const workflow = yaml.load(yamlString) as any
206+
const env = { ...workflow.env, ...options?.env }
207+
renderObject(workflow, { env })
208+
const dereffed = await $RefParser.dereference(workflow, {
207209
dereference: {
208210
circular: 'ignore'
209211
}

0 commit comments

Comments
 (0)