Running code from https://docs.github.com/en/free-pro-team@latest/actions/quickstart
why does this code create a syntax error:
- name: Checkout code
uses: actions/checkout@v2
but this is fine:
- name: Checkout code
uses: actions/checkout@v2
According to this YAML How many spaces per indent? there are no indentation requirements for YAML.
It's correct that the number of spaces can be freely chosen, but for the same node it has to be equal.
This is a mapping with two keys:
name: Checkout code
uses: actions/checkout@v2
but if you write it like this:
name: Checkout code
uses: actions/checkout@v2
then the uses: ... is seen as a continuation of the previous value for name. But it's invalid, because colons plus spaces aren't allowed in mapping values.
If it looked like that:
name: Checkout code
more
it would be valid YAML, equal to:
name: Checkout code more
So inside of that mapping, always use the same amount of spaces.
May I also recommend my short tutorial?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With