Home > database >  Can you use an `enum` with an input in GitHub Action's `action.yml` and a workflow file?
Can you use an `enum` with an input in GitHub Action's `action.yml` and a workflow file?

Time:09-22

I have a GitHub action (in .github/actions/my-custom-action) that takes an input which is an enum. In action.yml:

inputs:
  my-enum-input:
    description: "This is an input that's an enum"
    default: "all"
    required: true

Where INPUT_MY_ENUM_INPUT has a type like ['all', 'a', 'b'] that's checked in the script file called by the action.yml file. Is there a way to enforce the enum in the action.yml file as an input, and check the Worksheet YAML file that calls the action to make sure it's valid?

CodePudding user response:

There is currently no way for a GitHub Action to take a list/enum as input type, only strings are accepted at this time. There are a bunch of topics on this on the GitHub forums:

  • Related