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
Answer from riQQ on Stack OverflowTo 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
How to use an event.json file locally with nektos/act from their documentation they describe structure like:
# File: /path/to/event.json
{
"pull_request": {
"head": {
"ref": "sample-head-ref"
},
"base": {
"ref": "sample-base-ref"
}
}
}
Or follow steps in answer above to have github output the action event details and paste into this event.json file
Then to use the event file locally you can add the option --eventpath '/path/to/event.json' to your run act command, example:
act -W '.github/workflows/run_this_workflow.yml' -s GITHUB_TOKEN="$(gh auth token)" --eventpath '/path/to/event.json'