Skip to content

toYaml

toYaml(model: Model, options?: ToYamlOptions): string

Serialize a workflow or action model to a YAML string.

Keys are emitted in canonical order, comments are attached, and multiline strings use block-literal style. A header comment identifying the generating tool is prepended by default.

Parameter Type Description

model

Model

The model to serialize (e.g. from workflow or action).

options?

ToYamlOptions

Optional settings for header customization.

string

The rendered YAML string, including a trailing newline.

const yaml = toYaml(myWorkflow);
console.log(yaml);
// Suppress the auto-generated header comment:
const bare = toYaml(myWorkflow, { includeHeader: false });