actionlint
actionlint copied to clipboard
Actionlint too strict when checking matrix
I have a strategy matrix that looks like this:
strategy:
matrix:
service: ${{ fromJSON(needs.list-all-services.outputs.services) }}
exclude:
- service:
npm_project: foo
Where services is produced from a previous workflow like this:
echo "::set-output name=services::$(jq -c '' services.json)"
Actionlint gives the following:
value {"npm_project": "foo"} in "exclude" does not exist in matrix "service" combinations. possible values are [matrix]
I can see why actionlint thinks this code is wrong because it doesn't know what fields are available in services.json, but this code does work on GitHub Actions. Defining the services in a separate JSON file allows me to share it among other config files in my project so I don't have to duplicate lists.
Can we make actionlint allow any types in matrix when it isn't able to detect them?
Would you provide entire workflow file content so that I can reproduce the error exactly?
on:
workflow_call:
inputs:
services:
required: true
type: string
description: contents of services.json
jobs:
build-lint-test:
runs-on: ubuntu-latest
strategy:
matrix:
service: ${{ fromJSON(inputs.services) }}
exclude:
- service:
npm_project: foo
steps:
- run: echo 1