You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Compiler strips null at the end of any line in frontmatter steps:, corrupting run: scripts #79303
With gh-aw v1.2.2, a custom step in the frontmatter whose run: block has a line ending in : null is compiled with that null removed. A JSON document written by a heredoc then becomes invalid. The compiler reports no warning.
"a": null, is kept (the line ends with a comma), "b": null loses its value. At run time jq empty fails on the invalid JSON.
Expected
The run: script is copied as written: "b": null stays.
Cause
extractTopLevelYAMLSection marshals the section back to YAML, then calls CleanYAMLNullValues on the text (pkg/workflow/frontmatter_extraction_yaml.go L111-L113). That function applies :\s*null\s*$ to every line (pkg/workflow/yaml.go L105 and L450-L458). It is meant for keys like workflow_dispatch: null, but it cannot tell a mapping value from a line inside a block scalar. Custom steps go through it (pkg/workflow/workflow_builder_steps.go L14). By reading the code (not tested), post-steps, env, services and the other sections extracted the same way are exposed too.
The code is unchanged on v1.3.1 and on main.
Suggested fix
Drop null values on the parsed value before marshalling (or render nil as an empty value in the encoder), instead of a regex on the marshalled text. If the text pass stays, limit it to the on section, where workflow_dispatch: is the intended output, and skip block scalars. A test with the frontmatter above would cover it.
Workaround meanwhile: avoid a line that ends with : null in a run: block, for example build the JSON with jq -n.
Activity