github workflow - input type choice with multi-select option #34298
Replies: 9 comments 4 replies
-
| 
         As per my knowledge this is not yet implemented  | 
  
Beta Was this translation helpful? Give feedback.
-
| 
         No that is indeed not implemented. There is an issue that has gotten some traction but no one created a product feedback linked to it so I'll be doing it hoping that people who participated in this issue and thumb'ed it up will upvote here too: I'll also copy verbatim this issue description which is more complete: 
  | 
  
Beta Was this translation helpful? Give feedback.
-
| 
         See also https://github.com/orgs/community/discussions/8774, a (very active) discussion about how the limit of 10 workflow inputs is making job configuration difficult. Some users suggest multi-select options as an excellent workaround. There seems to be a lot of desire for this feature.  | 
  
Beta Was this translation helpful? Give feedback.
-
| 
         please I need this for my family  | 
  
Beta Was this translation helpful? Give feedback.
-
| 
         Yap I came here looking for exactly the same thing.  | 
  
Beta Was this translation helpful? Give feedback.
-
| 
         Currently working around the problem by listing multiple 'options' sets for the user to choose from, and leaving the validation 
 so leaving the team to be adults, and giving them a slightly-lagged warning (and broken build) if they get it wrong, to learn for next time and prevent bad builds (which can also be seen as deployments if you do GitOps). Feels like if it's getting this complex we should be moving to a more complex CD stack with more UI support, I don't exactly blame GitHub Actions team for not wanting this extra scope.  | 
  
Beta Was this translation helpful? Give feedback.
-
| 
         Here is a way to pass arbitrary JSON, including arrays, to actions that have  $ JSON_DATA=$(cat <<EOF
{
  "foo": "foo",
  "bar": [ "bar", "baz" ]
}
EOF
)
# tidy it up to one line
$ JSON=$(echo $JSON_DATA | tr -d '\n' | tr -d '[:space:]')
# run the workflow
$ gh workflow run foo-bar-baz.yaml --ref example -f config=${JSON}
✓ Created workflow_dispatch event for foo-bar-baz.yaml at example
To see runs for this workflow, try: gh run list --workflow=foo-bar-baz.yamlAction: name: Foo Bar Baz
on:
  workflow_dispatch:
    inputs:
      config:
        description: "Configuration (as JSON)"
        required: true
jobs:
  foo-bar-baz:
    runs-on: small
    steps:
      - name: Parse JSON Inputs
        id: input-values
        run: |
          json_data='${{ inputs.config }}'
          echo "foo=$(echo $json_data | jq -r '.foo')" >> $GITHUB_OUTPUT
          echo "bar=$(echo $json_data | jq -c '.bar')" >> $GITHUB_OUTPUT
      - name: Echo JSON
        run: |
          echo "Foo is ${{ steps.input-values.outputs.foo }}"
          echo "Bar is ${{ steps.input-values.outputs.bar }}"Output:  | 
  
Beta Was this translation helpful? Give feedback.
-
| 
         I came here looking for the same thing. Strange how many people want this but it's not yet a feature  | 
  
Beta Was this translation helpful? Give feedback.
-
| 
         It doesn't make any sense that you have to implement workarounds like this: workflow_dispatch:
  inputs:
    environment:
      description: Deploy environment name
      type: choice
      required: false
      options:
        - staging
        - production
        - all
      default: allAnd then ${{ (github.event_name == 'workflow_dispatch' && inputs.environment == 'all') && fromJSON('["staging", "production"]') }}The JSON array could be handled directly by a multi-select dropdown input instead.  | 
  
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
Is there any way i can enable multi-select dropdown option in
workflow_dispatchwith input type choice?Beta Was this translation helpful? Give feedback.
All reactions