Reputation: 3516
I have the following YAML specs for my action:
name: Build and test
on: [push, pull_request]
env:
buildDir: ${{ github.workspace }}/build/
jobs:
build:
strategy:
fail-fast: false
matrix:
os: [ubuntu-18.04, ubuntu-20.04, windows-2019, macos-10.15]
include:
- os: ubuntu-18.04
triplet: x64-linux
- os: ubuntu-20.04
triplet: x64-linux
- os: windows-2019
triplet: x64-windows
- os: macos-10.15
triplet: x64-osx
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
I verified that this passes validation of https://yamlvalidator.com/. And yet GitHub is telling me there was an error in my YAML syntax at line 27 (last line). I tried various different indentations of that part but all yield the same result.
Furthermore I tried removing the matrix block above and also using 4 instead of 2 spaces to indent everything but these changes also were unable to resolve the error.
I have absolutely no clue what is going on here. Any hints would be appreciated.
Upvotes: 0
Views: 2130
Reputation: 3516
As jonsharpe has mentioned in the comments the issue was not a YAML syntax error (as the error message indicated) but a semantic error of the specifics for GitHub actions: The steps
block was not indented far enough.
Here's the corrected version:
on: [push, pull_request]
env:
buildDir: ${{ github.workspace }}/build/
jobs:
build:
strategy:
fail-fast: false
matrix:
os: [ubuntu-18.04, ubuntu-20.04, windows-2019, macos-10.15]
include:
- os: ubuntu-18.04
triplet: x64-linux
- os: ubuntu-20.04
triplet: x64-linux
- os: windows-2019
triplet: x64-windows
- os: macos-10.15
triplet: x64-osx
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
Upvotes: 2