Reputation: 25547
I have a GitHub action step like this (extracted from a larger test.yml
file):
steps:
- name: Parse
shell: bash
env:
TYPE: ${{matrix.package-type}}
BV: ${{matrix.builder-version}}
# This comment is line 63, the "#" is in column 9
NULL: ${{ matrix.beta-version }}
run: |
echo TYPE is "$TYPE"
echo BV is "$BV"
printf "Null is '%s'\n" "$NULL"
When I run it, I get the following error:
The workflow is not valid. .github/workflows/test.yml (Line: 64, Col: 9): Unexpected value ''
Why is this line invalid? How do I fix it?
Upvotes: 10
Views: 25123
Reputation:
If you're using a reusable workflow, make sure you're not passing runs-on
to the job that uses
the workflow. The runs-on
is contained in the workflow file itself, not in the top level job.
The workflow is not valid. .github/workflows/REDACTED.yml (Line: 123, Col: 5): Unexpected value 'uses' .github/workflows/REDACTED.yml (Line: 124, Col: 5): Unexpected value 'with'
Upvotes: 15
Reputation: 10564
In my case it was because go-version
looked like this in the matrix section:
matrix:
go-version: 1.17
os: [ubuntu-latest, macos-latest]
It needed to be changed to an array: [1.17]
Upvotes: 0
Reputation: 25547
It turns out there is some quirk in the GitHub action YAML parser that treats NULL
as a special token. I guess it parses
NULL: ${{ matrix.beta-version }}
as if it were
'': ${{ matrix.beta-version }}
Changing NULL
to null
does not help. (Side note, keys to env
must be unique when compared in a case-insensitive comparison, meaning you cannot have both FOO
and foo
, even though the case is preserved when setting the environment variable name.)
The best fix/workaround is to avoid using "NULL" and use something else, like "NIL". However, if you must use "NULL", you can do it by putting it in quotes:
"NULL": ${{ matrix.beta-version }}
Upvotes: 4