Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Actionlint too strict when checking matrix #145

Closed
JavaScriptBach opened this issue May 25, 2022 · 2 comments
Closed

Actionlint too strict when checking matrix #145

JavaScriptBach opened this issue May 25, 2022 · 2 comments

Comments

@JavaScriptBach
Copy link

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?

@rhysd
Copy link
Owner

rhysd commented May 27, 2022

Would you provide entire workflow file content so that I can reproduce the error exactly?

@JavaScriptBach
Copy link
Author

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

@rhysd rhysd closed this as completed in 88d951b Aug 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants