Error when evaluating 'runs-on' for job 'build'. (Line: X, Col: Y): Unexpected value ''

Hi All,
Over at Apache Commons IO, I am trying to build on Windows and Ubuntu per the docs, but I get:

Error when evaluating 'runs-on' for job 'build'. (Line: 23, Col: 14): Unexpected value ''

from this maven.yml: https://github.com/apache/commons-io/blob/fe375a813d5b585f6057a9e472b26c142d55bc95/.github/workflows/maven.yml

name: Java CI

on: [push]

jobs:
  build:

    runs-on: ${{ matrix.os }}
    continue-on-error: ${{ matrix.experimental }}
    strategy:
      matrix:
        os: [ubuntu-latest, windows-latest]
        java: [ 8, 11, 14 ]
        experimental: [false]
        include:
          - java: 15-ea
            experimental: true        
      fail-fast: false
        
    steps:
    - uses: actions/checkout@v2.3.1
    - name: Set up JDK ${{ matrix.java }}
      uses: actions/setup-java@v1.4.0
      with:
        java-version: ${{ matrix.java }}
    - name: Build with Maven
      run: mvn -V --file pom.xml --no-transfer-progress

See this run: https://github.com/apache/commons-io/actions/runs/199298028

Any thoughts?

Thank you,
Gary

That additional matrix value lacks an os attribute, so I assume it defaults to empty.

That does not seem to do it: https://github.com/apache/commons-io/actions/runs/199469949

The workflow is not valid. .github/workflows/maven.yml (Line: 24, Col: 5): 'runs-on' is already defined,.github/workflows/maven.yml (Line: 33, Col: 17): Unrecognized named-value: 'matrix'. Located at position 1 within expression: matrix.os

What am I missing in the syntax?

Two problems in that new workflow (the first is what that error message points out):

    runs-on: ubuntu-latest
    runs-on: ${{ matrix.os }}
  1. You can only have one runs-on. The one with matrix.os should be correct.
        include:
          - java: 15-ea
            os: ${{ matrix.os }}
            experimental: true
  1. You’re defining a new matrix element here, so you have to give an actual value for os. Within the matrix there is no matrix to reference. Try something like this:
        include:
          - java: 15-ea
            os: ubuntu-latest
            experimental: true

ok, ty! I have the build running: https://github.com/apache/commons-io/actions/runs/199530612

@airtower-luna
Is there a way to run Java 15-ea without the include duplication in the YAML: https://github.com/apache/commons-io/actions/runs/199533761/workflow
?
TY,
Gary

Not that I’m aware of, no.