mvasigh / dispatch-action

Github Action for triggering other workflows via message passing
MIT License
57 stars 9 forks source link

##[error]Unexpected end of JSON input #5

Closed aroller closed 4 years ago

aroller commented 4 years ago

image

I followed the example given and I am getting this JSON error. I tried also with v1.1.4 and adding payload and debugging:

image

See the Actions in action. Your insight into the problem is appreciated.

mvasigh commented 4 years ago

This looks like a bug with how empty payloads are being handled and I've reproduced the bug on my end. Working on a fix now!

mvasigh commented 4 years ago

@aroller Could you verify that the fix is working for you? It's available at the bugfix/empty-json-payloads branch which you can point your workflow to. Once I know it's working for you as intended I'll merge the changes.

I tested the fix with various valid and invalid (as well as missing) JSON string payloads and think it should be behaving the way you want it to now.

Here's an example workflow step (note the uses property):

      - name: Emit repository_dispatch
        uses: mvasigh/dispatch-action@bugfix/empty-json-payloads
        with:
          token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
          repo: "@"
          event_type: sample_push
          debug: 1
          message: |
            {
              "foo": "bar",
              "multiline": "
                Testing a multiline JSON string
              ",
              "baz": 123456,
              "bool": true
            }
mvasigh commented 4 years ago

Closed this and released v1.1.5 which should fix it; if you continue to have this problem please open another issue. Thanks!