NewsCrawler.org

GitHub Actions accepts invalid YAML

The author writes that GitHub Actions accepts several invalid YAML constructs, so some real action and workflow files cannot be parsed by a YAML parser that follows the spec. The issue came up when a user reported that zizmor rejected a workflow with a step that uses jsdaniell/create-json@v1.2.3 and passes the json key as a multi-line flow-style[1] string.

According to YAML 1.2.2 § 8.2.3, flow nodes nested inside a block-style[2] parent collection must be indented by at least one more space than that parent, and this step breaks that rule. The correct version differs by a single space of indentation. The author first changed tree-sitter-yaml to accept the step, then opened a change to revert that fix.

The author thinks GitHub's parser is probably YamlDotNet, and that Actions appears to use YamlDotNet 5.3.0, released in 2018. Upgrading to 18.1.0 would not fix the bug, because it is still present in that version. The author guesses that a 2020 patch fixed only the double-quoted form, because YAML's official test suite checks rule 8.2.3 only with double-quoted strings.

Read the original yossarian.netDiscussion

Discussion

Several commenters say they are not surprised, and one calls valid YAML an oxymoron. Another asks whether fixing the parsing would break existing workflows and warns against adding a "quirks mode". One commenter says their satisfaction with GitHub Actions has steadily declined, and a question about alternatives to GitHub gets no answer.

Sources

Published: First seen: Читать по-русски

Open as a page