GitHub Actions - Print GitHub Webhook events and payloads
Many times, I want to know what the Json payload looks like when an event occurs on GitHub that triggers a GitHub Actions workflow.
In the past, I used to setup a Webhook that sends the json payload to my local server. Now, I use GitHub Actions to print the whole json payload.
The delete event sends a delete webhook payload.
To print out the payload, I use the workflow below:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
name: Dump GH events and payloads
on:
delete
jobs:
test:
name: debug
runs-on: [ubuntu]
steps:
- name: print whole context
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
VARS_CONTEXT: ${{ toJson(vars) }}
run: |
echo "GITHUB_CONTEXT is $GITHUB_CONTEXT"
echo "VARS_CONTEXT is $VARS_CONTEXT"
echo "delete event is ${{ GITHUB_CONTEXT.event }} "
This post is licensed under CC BY 4.0 by the author.