Dropdown Input choice workflows in GitHub Actions

Tzahi Kolber
2 min readJul 25, 2023

Sometimes, it's easier to select an existing option from a dropdown box, when running an automation process rather than filling up the input or preparing different scripts for each option.
In this blog I will demonstrate how it can be done with GitHub Actions.

Setting up the options “menu”

The input choice menu is really easy to setup and later on inside the script, I will show how to use it.
The input choice menu is built as the next format:

We use the type and the options according to the relevant needs.
When we run the GitHub Actions, we will get the option to choose between the choices we have configured, along with the default choice we setup in the Yaml file:

Using the input inside the scripts

After we learn how to setup the input menu and the different choices, we need to apply them in the script we are running and use them.
The format is really simple, while in this example I used a PowerShell script:

if (“${{ github.event.inputs.environment }}” -eq ‘Stop’) {
write-host “Stop was selected”}

if (“${{ github.event.inputs.environment }}” -eq ‘Start’) {
write-host “Start was selected”}

Using the options menu in Azure PowerShell

As I mentioned earlier, I used this YAML file in GitHub Actions to stop and start Azure Firewall.

You can download the full YAML file here:

--

--

Tzahi Kolber

During the last 15 years, I was working as a Senior PFE within Exchange area at Microsoft. Now I’m Senior Consult as Azure IAAS, PowerShell & Automations.