Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Github Actions $GITHUB_OUTPUT, Error: Invalid Format without any multiline strings

I am trying to write a Github Action that outputs the result of a curl HTTP call to a JSON endpoint processed with jq to the output of that step, like so:

      - name: Get existing Neon branch for this PR
        id: get-existing-branch
        run: |
          echo "branch_id=$(
            jq --raw-output '.branches[] | select(.name | startswith("PR #${{ inputs.pr-number }} ")).id' list-neon-branches-response.json
          )" >> "$GITHUB_OUTPUT"

But I keep getting this error:

Error: Unable to process file command 'output' successfully.
Error: Invalid format 'br-shrill-unit-918412'

I see a number of issues that generally tell people that they're doing it wrong for multiline strings, but that's where I'm stumped - this isn't multiline. Any ideas? Some source code:

  • Action runthrough where it failed
  • Source of the workflow

Thanks all!

like image 374
osdiab Avatar asked May 29 '26 14:05

osdiab


1 Answers

I changed it to this:

      - name: Get existing Neon branch for this PR
        id: get-existing-branch
        run: |
          branch_id="$(jq --raw-output '.branches[] | select(.name | startswith("PR #${{ inputs.pr-number }} ")).id' list-neon-branches-response.json)"
          echo "Branch ID: $branch_id"
          echo "branch_id=$branch_id" >> "$GITHUB_OUTPUT"

And now it’s happy. Welp.

like image 164
osdiab Avatar answered Jun 04 '26 17:06

osdiab