I use GitHub Actions and want to test it locally. I'm using this tool and it works fine. https://github.com/nektos/act
I can provide a event.json for local testing, but it's really hard to create a real event payload.
Is there any way to get real event payload? For example, I create pull request on my repository from the console, and get that event payload json.
Act the solution. The two important reasons that you should use Act: Fast Feedback - Rather than having to commit/push every time you want to test out the changes you are making to your . github/workflows/ files (or for any changes to embedded GitHub actions), you can use act to run the actions locally.
The payload URL is the URL of the server that will receive the webhook POST requests.
To get event data, you can use a GitHub action to print the event to the log.
# change this to the event type you want to get the data for
on:
pull_request:
types: [opened, closed, reopened]
jobs:
printJob:
name: Print event
runs-on: ubuntu-latest
steps:
- name: Dump GitHub context
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: |
echo "$GITHUB_CONTEXT"
Alternatively, you can find example event data in the documentation: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#webhook-payload-example-30
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With