organization-workflows icon indicating copy to clipboard operation
organization-workflows copied to clipboard

Question - How can I view the full json payload?

Open vikas027 opened this issue 3 years ago • 1 comments

I need some help/guidance in inspect/view the full json payload in the dispatch event documented in the README.md.

My goal is to get the pull request number of the repository that has triggered the workflow.

I have tried a few options in vain

echo ${{ github.event.client_payload }}  # just prints Object
echo ${{ github.event.client_payload.pull_request_url }}  # does not output anything
echo ${{ github.event.client_payload.event.pull_request.number }} # does not output anything

vikas027 avatar Jul 06 '22 03:07 vikas027

Hi Vikas. This has to do with that it sends the push payload and not the pull_request payload. https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#push

You could however try to leverage the GitHub API to find which PR a commit belongs to: https://docs.github.com/en/rest/commits/commits#list-pull-requests-associated-with-a-commit

SvanBoxel avatar Jul 13 '22 13:07 SvanBoxel