When include and exclude statements are specified in a job's strategy matrix, they cannot be an array type. Specifying them as such results in a run failure.
phpunit-tests:
name: PHP ${{ matrix.php }}
strategy:
matrix:
os: [ 'ubuntu-latest', 'macos-latest' ]
php: [ '8.3', '8.4', '8.5' ]
include:
# Include jobs that test with memcached.
- os: 'ubuntu-latest'
php: [ '8.2' ]
exclude:
- os: [ 'macos-latest' ]
php: '8.3'
While it would be amazing for Actions to support non-scalar (it would allow a single include/exclude statement to include multiple combinations), it currently does not. It can be easy to accidentally specify the values as an array, especially when someone copies the line from for the same variable from the overall matrix to spell the variable name correct or not have to fully type it out.
The error message is not super descriptive and the reason may not be obvious:
Error: The template is not valid. .github/workflows/workflow-name.yml (Line: 56, Col: 33): A sequence was not expected
I believe this would be a great safety check to add to provide more context.
When
includeandexcludestatements are specified in a job's strategy matrix, they cannot be an array type. Specifying them as such results in a run failure.While it would be amazing for Actions to support non-scalar (it would allow a single
include/excludestatement to include multiple combinations), it currently does not. It can be easy to accidentally specify the values as an array, especially when someone copies the line from for the same variable from the overall matrix to spell the variable name correct or not have to fully type it out.The error message is not super descriptive and the reason may not be obvious:
Error: The template is not valid. .github/workflows/workflow-name.yml (Line: 56, Col: 33): A sequence was not expectedI believe this would be a great safety check to add to provide more context.