So I have a bash command like
- name: Get waiting pull_request_id
id: get_pr_id
run: |
prId='${{ steps.get_in_progress_workflow_run.outputs.data }}' | jq '.workflow_runs' | jq '.[] | first(select(.status=="in_progress"))' | jq '.pull_requests' | jq '. | first' | jq '.number' \
echo "$prId" \
echo "prId=$prId" >> $GITHUB_OUTPUT
I am using this to lookup a workflow that is in progress and extract the pull request Id. I want to output the pull requestId to use in the next step
The error is
jq: error: Could not open file echo: No such file or directory
jq: error: Could not open file : No such file or directory
jq: error: Could not open file echo: No such file or directory
jq: error: Could not open file prId=: No such file or directory
So it seems that even with the \ I am still in the context of the previous line of script. I have tried semicolons to no avail. How can I make this work?
If I remove the backslashes, then the first line never seems to query anything or even execute as I get no output at all
I have verified that the first cmd line does return the prId if I echo it instead of assigning to a variable. I have tried to echo into the github output directly from that 1st line, but it requires quotation marks and I can't figure out how to do a jq select without using quotes.