Closed cjyar closed 3 years ago
This is a function of the yaml spec. https://yaml.org/type/bool.html Does github handle it properly if you quote the key?
echo '"on":' | spruce merge
Thanks for setting me straight! YAML is more complicated than it looks.
GitHub parsing doesn't seem to believe that on
and true
mean the same thing, in the context of a YAML key. I tried these combinations in a GitHub Actions file:
on:
works"on":
workstrue:
fails"true":
failsAs far as Spruce's parsing, here's what I see providing the same things to spruce merge
:
on:
-> true: null
"on:"
-> "on": null
true:
-> true: null
"true":
-> "true": null
So it seems like a workaround would be to double quote on
, as you suggested. (Or the verbose and explicit !!str on
might work?)
Still, I wonder if it's a bug in somebody's YAML parsing. 1.0.3.2 for the core schema doesn't say anything about on
or off
, but the link you gave for the bool datatype sort of implies otherwise. Should Spruce and GitHub parse a scalar on
using the same tag?
closing as stale
It seems like spruce is trying to interpret the key name as a boolean. This causes problems when processing YAML for GitHub Actions, where
on
is a top level element of the file.