Trigger a github action on a simple POST request like this curl :
curl -XPOST -u "[username]:[token]" \
-H "Accept: application/vnd.github.everest-preview+json" \
-H "Content-Type: application/json" \
https://api.github.com/repos/[username]/[repo]/dispatches \
--data '{"event_type": "[your-event-type]"}'
You will have to replace some of the values in your CURL requests :
Key | Value |
---|---|
token | Your Github personal access token (Create personal token with repo rights, there is a tutorial). |
username | Your Github username |
repo | Your Github repo where you will trigger the github action |
your-event-type | Your event-type used in your workflow yml |
Here's an example for this repo to trigger the github action:
curl -XPOST -u "Tharushan:ghp_fACErabYlsBdFNMdjIUhTvBjwxIjMVtvDCsF" \
-H "Accept: application/vnd.github.everest-preview+json" \
-H "Content-Type: application/json" \
https://api.github.com/repos/Tharushan/github-actions-webhook/dispatches \
--data '{"event_type": "webhook-trigger"}'