Repository navigation
Description
Bug
Workflow names are interpolated into hand-written double-quoted YAML without escaping the value. A valid frontmatter string containing a quotation mark or newline therefore does not reliably round-trip into the generated workflow.
The same issue affects the default run-name derived from the workflow name. Setting an explicit run-name avoids that second emission site but does not correct serialization of name itself.
Reviewed on main at c0a0ba9a241c16d1db76adfc2bd170b03379b681:
pkg/workflow/compiler_yaml.go:83writesfmt.Fprintf(yaml, "name: \"%s\"\n", data.Name).pkg/workflow/tools.go:45–46constructs the defaultrun-namefrom unescapeddata.Name, using the same manually quoted%spattern.
Minimal example
Create .github/workflows/quoted-name.md:
---
on: workflow_dispatch
permissions:
contents: read
name: 'Example "quoted" workflow'
run-name: 'Example run'
---
# Example
Summarize the repository.Compile with:
gh aw compile quoted-nameThe current name emitter constructs this fragment:
name: "Example "quoted" workflow"That is not a correctly serialized scalar. Removing the explicit run-name exercises the second affected emitter as well.
This report confirms the current source/emission behavior; it does not claim a fresh end-to-end CLI reproduction on the cited revision.
Expected behavior
Compilation should preserve the original name as a single YAML string. Quotes, backslashes, line breaks, and other supported characters should either be encoded correctly or rejected with an explicit, field-specific validation error. String contents must not change the surrounding generated mapping.
Suggested fix
- Replace manual
"%s"quoting at both sites with the repository's YAML-aware scalar serialization/escaping helper, or introduce one shared helper and use it consistently. - Preserve any intentional, supported display-name expression behavior while keeping string serialization separate from expression validation.
- Audit other emissions derived from the same name/title value for the same formatting pattern.
- Add compiler regressions for quotation marks, backslashes, LF/CRLF, Unicode, punctuation, and names derived from Markdown headings, both with and without an explicit
run-name. - Parse generated YAML in the regressions and assert that the decoded scalar equals the source value and that the surrounding top-level key set is unchanged. Check error behavior and lock-file output when input is rejected.
Both affected fields are included here because they share the same serialization defect and should be corrected together.
Activity