Please explain the difference between these 2 event triggers with some real world example.
Apparently, repository_dispatch
events may only be read on the default branch
See:
workflow_dispatch
repository_dispatch
For the latter, from William Villeneuve :
# TODO: replace :token, :user, and :repo
curl -H "Authorization: token :token" \
-H 'Accept: application/vnd.github.everest-preview+json' \
"https://api.github.com/repos/:user/:repo/dispatches" \
-d '{"event_type": "awesomeness", "client_payload": {"foo": "bar"}}'
name: example-client-payload-action
on: repository_dispatch
jobs:
test:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- run: 'echo "field: ${{ github.event.client_payload.foo }}"'
- run: 'echo "payload: ${{ toJson(github.event.client_payload) }}"'
- run: echo baz
if: github.event.action == 'baz'
As seen here:
Just posting here since it doesn't seem to be documented - you can also specify a list of types to trigger on:
on:
repository_dispatch:
types:
- manual-trigger-mytest
- manual-trigger-all
From "Manually Trigger A GitHub Actions Workflow"
The way I understand this is:
Dispatch is any process that is triggered by something "outside GitHub". Example: A person clicking a button OR an API being called.
Having that said:
event_type
that you can use on your yaml workflow at on/repository_dispatch/types
.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