Azure / Azure/bicep-deploy

Should enum inputs be case-insensitive?

Open
#123 0 comments 1 reaction 0 assignees View on GitHub
Area - Inputs enhancement
Dominant language
TypeScript
Stars
64
Forks
20
Avg merge
15h 37m
Merged PRs (30d)
4

Description

We have various action inputs that take a fixed set of values, or a list of a fixed set of values.

Some examples:
`type` - must be either `deployment` or `deploymentStacks`
`scope` - must be either `tenant`, `managementGroup`, `subscription` or `resourceGroup`

Currently our validation logic is strict - the casing has to match exactly. This means that we would reject `scope: Tenant` or `type: deploymentstacks`.

As raised in https://github.com/Azure/bicep-deploy/pull/85#discussion_r1906865668, this is a bit odd with our `environment` input, as it requires camel case (`azureCloud`, `azureChinaCloud`, `azureGermanCloud`, `azureUSGovernment`), whereas the `environment` input for the "azure-login" action (which this is commonly used with) requires Pascal Case (`AzureCloud`, `AzureChinaCloud`, `AzureGermanCloud`, `AzureUSGovernment`) - see https://github.com/marketplace/actions/azure-login#environment

IMO the best option for dealing with this inconsistency would be to relax our validation such that we don't care about casing for enum inputs.

Contributor guide

Open the contributing guide

Research direction

Start by locating the validation logic for action inputs and the enum definitions for type, scope, and environment. Review any existing validation tests, then verify that accepted values with different casing behave consistently while invalid values remain rejected.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure, github-actions, typescript
Domain
ci-cd, devops
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.