Setting strategy.matrix.value to expression throws invalid type error
See original GitHub issueGetting “Invalid type found: array was expected but string was found” at matrix: value: ${{fromJson(needs.setup.outputs.matrix)}}
Any ${{}} expression fails. Only [] is allowed now, with at least one value. But the value cannot be an expression.
`name: Test Matrix
on: workflow_dispatch:
jobs:
setup: runs-on: ubuntu-latest outputs: matrix: ${{ steps.matrix.outputs.value }} steps: - id: matrix run: | echo ‘::set-output name=value::["a", "b", "c"]’ build: needs: [ setup ] runs-on: ubuntu-latest strategy: matrix: value: ${{fromJson(needs.setup.outputs.matrix)}} steps: - run: | echo “${{ matrix.value }}”`
Issue Analytics
- State:
- Created 2 years ago
- Reactions:7
- Comments:31 (7 by maintainers)
Top Results From Across the Web
Github Actions: How use strategy/matrix with script
One final note: I attempted to just pass the matrix array of values to jobs.<job_id>.strategy.matrix.includes but this fails because matrix.
Read more >With github actions, Is it possible to populate a matrix ...
The above throws the following error: Error when evaluating 'strategy' for job 'job1'. Unexpected type of value '[One String, ...
Read more >Expression evaluation error at function 'contains' [line 39]
Hello All, I need to read an array extracted by a datasubset just to know if it contains a particular string. Following the...
Read more >How to Fix: runtimewarning: invalid value encountered in ...
This error simply occurs when we performing a math operation and we encounter which is not valid as input. When we perform some...
Read more >How to Handle the Incompatible Types Error in Java
The Java incompatible types error happens when a value assigned to a variable or returned by a method is incompatible with the one...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This was driving me crazy, originally I was using
cat
andjq
together to get the content into a string:cat releases.json | jq 'tostring'
and then adding it to theGITHUB_OUTPUT
:but when I ran the workflow I always got this error:
Note: I’ve been using the
include
property when defining the matrix.Anyways, for some reason a pair of single quotes were added even removing with sed threw another error message:
The solution that I found was to use a multiline string, e.g.:
Job using matrix:
In case someone wonder, this is the JSON content structure:
I hope this helps other people, cheers!
hi,
seems to be a bug and it did fail until I rewrote every line manually with all the correct indentations and spaces
also i found out that if you copy-paste it from somewhere it does not run seems to me that there are hidden chars while copypasting
i ignored the error ‘invalid type found: array was expected but string was found’ and continued it might a case of incorrect indentations and spaces , not sure, if so its a bug for sure.
still error should not appear while editing
my account.txt file is:
1111111 2222222