Syntax for getting the repository_dispatch type

Roughly what I need is this:

    types: [this, that, the-other-thing]
  DISPATCH_TYPE: ${{ github.event.??? }}

But I can’t figure out the proper incantation to find out what the repository_dispatch type was that triggered my action, and I can’t find it in the documentation anywhere.

Any suggestions?

@m-hilgendorf ,

Sure, you can use the property " github.event.action" of the github context to fetch the activity type of the repository_dispatch event.

The activity type ( event_type , Required) is a custom webhook event name define in the request body when you run the " Create a repository dispatch event" API. You can set the name as any you like.

When using the API to trigger a workflow on the repository_dispatch event, the data you set in the request body will be passed into the github context of the triggered workflow run. The value of " event_type" will be passed to " github.event.action", and " client_payload" will be copied into the github context as a sub-object of " github.event".

Related docs:

External events: repository_dispatch

Create a repository dispatch event

1 Like