Below are several examples for how to kick off workflow jobs manually via curl (or any external event)
Notice the event_type
matches the workflow field: on.repository_dispatch.types
. the workflow file name does not need to match.
$ curl -XPOST -u "drewmullen" \
-H "Accept: application/vnd.github.everest-preview+json" \
-H "Content-Type: application/json" \
https://api.github.com/repos/drewmullen/actions-playground/dispatches \
--data '{"event_type": "external-echo"}'
Enter host password for user 'drewmullen': <YOUR PAT>
repository_dispatch
always uses master branch. To use another branch, view this workflow and set client_payload.ref
:
curl -XPOST -u "drewmullen" \
-H "Accept: application/vnd.github.everest-preview+json" \
-H "Content-Type: application/json" \
https://api.github.com/repos/drewmullen/actions-playground/dispatches \
--data '{"event_type": "my-dispatch", "client_payload": {"ref": "test-pr4"}}'
If you'd like the same event to kick of specific jobs, use the if
condition.
curl -XPOST -u "drewmullen" \
-H "Accept: application/vnd.github.everest-preview+json" \
-H "Content-Type: application/json" \
https://api.github.com/repos/drewmullen/actions-playground/dispatches \
--data '{"event_type": "multi-dispatch", "client_payload": {"ref": "test-pr6", "project": "dir1"}}'