How to set a default value for a workflow_dispatch variable?

I see people using workflow_dispatch github.event.inputs as I am here: ltabus/up.yml at 8e896bb75330757e440fe7f429aaa9ead7cfd90e · kaihendry/ltabus · GitHub

But how do you set a default if the job is run on a push?!

1 Like

Unfortunately, this is not possible. There is no way for you to define inputs on a push event. The github.event.inputs context will contain key value pairs only if the workflow was triggered by a workflow_dispatch event.

I keep on getting bitten by this issue. I want to deploy to staging by default. And then

And then run production once I’ve manually tested staging:


I’m really tired of:

Is there no sane workaround?

@kaihendry Have an approval on production environment. Then staging deploys and waits for production to be approved

While not DRY, this is a possible workaround:

stage: ${{ github.event.inputs.stage || 'staging' }}

Or like this, using a pseudo-ternary operator:

stage: ${{ github.event_name == 'push' && 'staging' || github.event.inputs.stage }}


I just ran across this issue myself. I want to define inputs as per workflow_dispatch with default values that are defined when using other event triggers.