Back

GitHub Actions accepts invalid YAML, complicating strict parsing
SiTech AI Team2 min read

GitHub Actions accepts invalid YAML, complicating strict parsing

A TIL post says GitHub Actions accepts several invalid YAML productions, including a workflow step using a multi-line flow-style string that a conforming parser rejects. The issue traces to parser behavior and YAML indentation rules.

GitHub Actions accepts several invalid YAML productions, making it difficult or impossible to parse some real-world action and workflow definitions with a properly conforming YAML parser, according to a TIL post dated 2026-11-22. The post connects the issue to zizmor#1116, which had affected the author for about a year and a half, and says that last April a user reported zizmor rejecting a workflow containing a step that creates an NPM remote repository JSON using jsdaniell/[email protected].

Invalid indentation in a workflow step

The reported step used a multi-line flow-style string for the json key. Under YAML 1.2.2 section 8.2.3, flow nodes nested inside a block-style parent collection must be indented by at least one more space than the parent block collection. The posted example omitted that extra indentation, so it is not valid YAML even though GitHub Actions accepts it.

The corrected form adds one space before the closing brace of the flow string. The post says the difference is barely visible and that YAML's size and complexity made the invalidity hard to recognize.

Parser and tooling impact

The author first opened tree-sitter-yaml#36 to change parsing behavior, then opened tree-sitter-yaml#51 to revert that change. On GitHub's side, the author says much of the Actions code is proprietary and that the underlying parser is likely YamlDotNet. Actions appears to use YamlDotNet 5.3.0, released in 2018.

Even upgrading to YamlDotNet 18.1.0 would not fix this bug, because it remains present in that version. The post points to a !isSingleQuoted guard and suggests a 2020 patch, YamlDotNet#467, fixed only the double-quoted form. It says YAML's official test suite tests rule 8.2.3 only with a double-quoted string, although the rule applies to both forms.

Sources: yossarian.net

SiTech

SiTech — AI-powered web development

We build fast, modern websites and bring AI into real business workflows. Have a project or a question? We'd love to help.