GitHub actions inputs don't get printed with echo

I’ve been trying to set up the most basic GitHub action that can be triggered via API, and I managed to trigger it, but now I’m having trouble passing down the "inputs" and using them in the jobs…
I tried reading the documentation and all, and it should work but I’m probably missing some syntax or something…
Here’s the action code:

name: Test

        default: 'testdefaultvalue'
        description: 'Test desc'
        required: true
    runs-on: ubuntu-latest
    - name: Print inputs
      run: echo "The inputs are ${{ inputs.body }}"

And here’s the body that I’m trying to send using POST which hits and triggers this action

{"event_type": "my_event", "client_payload": {"body": "Hello, world!"}} 

I keep getting only the first part of the echo, like on this screenshot
enter image description here

I even tried just printing out the inputs body with the default value using a different kinds of syntaxes but nothing worked. Hopefully, this is not a duplicate and someone will help me and it’ll be useful for someone in the future as well!

>Solution :

According to repository_dispatch, you need to refer to the complete event context to get the values.

So, this should work in your case:

echo ${{ github.event.client_payload.body }}

Leave a Reply