Github Actions and RepositoryDispatch

Hello, I’ve been implementing Github Actions as the CI for a project I’m working on.

The workflow I have is triggered on merge to a development branch. However, I want to be able to also trigger builds to production, of the master branch, which holds my production code-base.

The issue here is that I don’t want it to be triggered manually. I might have to delay the deployment or even protect the environment from accidental deployments. This means I must be able to manually trigger the CI, ideally through a webhook of some sort.

I have researched about this and from what I understood, I’m supposed to use this, but I can’t seem to figure out how it connects back to Github Actions.

What should be my webhook payload in order to trigger the intended action? What if I have multiple “repository_dispatch” triggered workflows, how could I differ between them?

I have looked everywhere for this and still have no real idea of how it actually works. Thanks in advance!

1 Like

Thanks for reaching out.

It looks to me like you would make your workflow trigger on the repository_dispatch event. So I did a quick code search based on that assumption. That brought me to this workflow which uses the on = "repository_dispatch" pattern I guessed. From there, you could differentiate the workflows based on the contents that you supplied to action when you sent the message described in step 2 of the instructions on the page you linked.

I hope that helps!

1 Like

I want to trigger specific action within RepositoryDispatch with given event\_type. How can I prepare a workflow triggered by repository\_dispatch with specific event\_type?