With the Github API
On the official Github Documentation, there is a service to create a workflow dispatch event
Here is a curl example:
curl \
-X POST \
-H "Accept: application/vnd.github.v3 json" \
https://api.github.com/repos/octocat/hello-world/actions/workflows/42/dispatches \
-d '{"ref":"main"}'
Note that you can also send workflow inputs
through this API as well.
You can also find more references about this in this article.
There is also another Github API service to trigger repository_dispatch events.
Bonus
If you're looking for triggering those workflow_dispatch
events (and repository_dispatch
events) through a terminal command line, you can use this automation in Python. The implementation can be found in this class.