TIL: GitHub Actions accepts invalid YAML
“TL;DR: GitHub Actions accepts several invalid YAML productions, making it difficult (read: impossible) to parse some real-world action and workflow definitions with a properly conforming YAML parser.”
Jump to Highlight ↗
This is related to zizmor#1116, which has been bugging me for a year and a half.
Last April, a user reported that zizmor was rejecting a workflow containing a step that looks like this:
Apart from the use of a multi-line flow-style string for the json: key, nothing particularly stands out about this step.
Except: it isn't valid YAML! YAML says this about flow-style nodes that are nested inside of a block-style parent collection (read: map or array):
Flow nodes must be indented by at least one more space than the parent block collection. Note that flow nodes may begin on a following line.
YAML is a big and complicated spec, so it didn't even occur to me that this was invalid. Instead, I opened tree-sitter-yaml#36 to "fix" it. I've now opened tree-sitter-yaml#51 to revert that misbegotten fix.
On GitHub's side, I'm not sure if they have a clean path towards spec conformance here. Much of the code behind Actions is proprietary, but it seems likely that the underlying parser on their end is YamlDotNet.
📝 Your Private Notes & Highlights 🔒 Only visible to you
Log in or create a free account to keep private highlights and personal notes on your stored picks.
Featured on Storesso
Are you the creator of yossarian.net? Share your verified feature badge on your website, or export a custom 4:5 editorial social card for Instagram and X.
Generate a 1080×1350 vertical high-res feature card tailored for social sharing.
Instagram & X Feature Card
Export a polished, high-resolution 4:5 editorial graphic displaying your verified inclusion in the Storesso Discovery Index. Perfect for launch threads, founder updates, and newsletters.