Trigger job only when workflow_dispatch is used

I have a workflow where I want to run tests and build on all pull requests, but only deploy if the job is executed with workflow_dispatch. Ideally, these would be separate workflows, but actions does not appear to support a job in one workflow having a dependency on a job in a different workflow. Is there anything that workflow_dispatch sets that can be checked for in a condition?

Check github.event_name from the github context. I think a job-level condition like this should work:

if: github.event_name == 'workflow_dispatch'
1 Like