Skip to main content

interpolate_template

Function interpolate_template 

Source
pub fn interpolate_template(template: &str, context: &WorkflowContext) -> String
Expand description

Interpolate {{variable}} template patterns in a string.

Replaces {{key}} patterns using two sources:

  1. context.step_outputs — previous step results. Both {{step_id}} and {{step_id_output}} resolve to the output of step step_id.
  2. context.variables — shared workflow variables.

Order: Longer patterns are replaced first to avoid substring conflicts. {{step_id_output}} is replaced before {{step_id}}.

Example:

let template = "Review {{read_diff_output}} with focus on {{focus_area}}";
// If read_diff has output and focus_area = "security":
// → "Review <output> with focus on security"