Optimization for repository_dispatch event in Github Action Workflows

When filtering jobs triggered by repository_dispatch event with some event_type the filtering happens in the job. So all workflows that run on repository_dispatch get triggered and show up in the repository actions tab.

But eventually the jobs and workflows get skipped that do not match the event_type, Example taken from prometheus/prometheus:


on: repository_dispatch
name: Workflow Name Here
    name: Benchmark Start
    if: github.event.action == 'benchmark_start'

So if there are two workflows which are triggered on repository_dispatch both of them will get triggered but only one will get filtered if the event_type/event.action is matched.

It’ll be nice to have some kind of optimization for repository_dispatch events so that only the workflows that have a particular event_type/event.action get triggered.

You could add types key to repository_dispatch event, like:

    types: [prombench_start,prombench_stop]

Then the workflow will not be triggered if the event_type / event.action is not matched.