0

So i have a github actions that fetches a json and then extracts a specific field into a new json array using

jq -r '[.hits[].id]' 

which results in this file: https://github.com/Jodsderechte/Jodsderechte.github.io/blob/main/Data/WaList_Converted.json

however if i try to use that in a matrix job using

${{fromJson(needs.setup.outputs.wa_List)}}

i get

Error when evaluating 'strategy' for job 'Request'. .github/workflows/RequestWagoData.yml (Line: 67, Col: 19): Error parsing fromJson,.github/workflows/RequestWagoData.yml (Line: 67, Col: 19): Error parsing fromJson,.github/workflows/RequestWagoData.yml (Line: 67, Col: 19): Error reading JToken from JsonReader. Path '', line 0, position 0.,.github/workflows/RequestWagoData.yml (Line: 67, Col: 19): Unexpected value ''

I guess this is because of the newlines but i'm not sure. i tried like a million different things trying to follow the advice in How to Remove \n and \r from JSON string using Bash? and Github Actions: How use strategy/matrix with script

but i can't for the live of me figure it out

https://github.com/Jodsderechte/Jodsderechte.github.io/edit/main/.github/workflows/RequestWagoData.yml here is the whole action including my history of 300 failed atempts of getting this to work

24
  • It might indeed be related to the new lines. Did you try informing the JSON hardcoded in the matrix strategy as it is, and then without breaking lines to check? Commented Jun 15, 2023 at 11:36
  • -c with jq will give you the compact JSON without newlines. Commented Jun 15, 2023 at 11:39
  • In jq -r '[.hits[].id]' << fetch-api-data-action/WeakAurasList.json >> $GITHUB_OUTPUT, the output parameter name is missing i.e. wa_List. What is content here? Commented Jun 15, 2023 at 11:42
  • i did hardcode the json into the matrix strategy and it works then yeah i'll try that -c thanks! Commented Jun 15, 2023 at 11:42
  • 1
    thank you! it also was that i previously used ${{ env.steps.createList.outputs.content }} instead of ${{ steps.createList.outputs.content }} meaning everything i tried couldn't even work anyways Commented Jun 15, 2023 at 13:59

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.