3

I'm using the workflow_dispatch option to trigger my workflow and I have a choice input variable. I would like to set the choice variable's options parameter from either an environment variable or a simple variable. Is it possible? The code would look something like:

on:
  workflow_dispatch:
    inputs:
      suites:
        type: choice
        description: Select test suite
        required: true
        options: ${{ vars.all_suites }}

Thank you so much!

KatKibo
  • 133
  • 2
  • 9

1 Answers1

0

As far as I'm aware this isn't possible. The variables aren't available when invoking the dialog. I ran a few experiments, and it even throws magic unicorns at the moment. The documentation on this subject are scarce unfortunately, so there isn't a clear doc I can point you to that spells out whether this is supposed to work or not. The absence of docs usually doesn't tell you conclusively whether something might work.

jessehouwing
  • 106,458
  • 22
  • 256
  • 341
  • Sad story. Thanks! Do you know of any other possibility to solve this in a nice way? Or another solution that could work for me is referencing the list I provide in the options filed. Something like ${{ inputs.suites.options }}. This way I could avoid defining the same list twice. – KatKibo Mar 01 '23 at 11:30
  • Why would you need to define the same list twice? Are you trying to use the same list in two workflows? – jessehouwing Mar 01 '23 at 13:41
  • There's an 'All' option in my test suites list and if that is chosen by the user, I have to iterate through all test suites. So once I have to define it for the choice parameter and for one more time, for the actual test execution as a parameter. – KatKibo Mar 02 '23 at 08:22
  • Ahh I get it! In theory you could parse the YAML ;). But no, there's no easy way to capture the options in a variable. – jessehouwing Mar 02 '23 at 08:30