Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Create Github Actions choice input options from a file

Right now, we're running a manual workflow in order to deploy our product to production. We have one input and we can choose our brand which needs to be deployed.

It's including options like

on:
  workflow_dispatch:
    inputs:
      dst:
        type: choice
        description: Select destination brand
        required: true
        options:
          - A
          - B
          - C

and so on

My question is, is it possible to read this options from a file (like a text file which is in our project)? I looked at it but I couldn't see a solution from others.

Thank you so much!

like image 786
Cemil Uzunhasan Avatar asked Jun 25 '26 19:06

Cemil Uzunhasan


2 Answers

No - it's not possible to have dynamic workflow configurations at the moment, I'm afraid.

The solution I personally use is to trigger this type of workflow using workflow_dispatch event with proper input options.

Instead of triggering it manually on web, you can have a script that locally reads the file with all options and let you pick desired option locally, then it will trigger workflow_dispatch event with the selected input.

Another alternative if you don't want local parsing will be to make input as regular string and then add a step in your workflow that will read a file after actions/checkout and check if it's a valid option.

like image 191
Grzegorz Krukowski Avatar answered Jun 28 '26 14:06

Grzegorz Krukowski


One hack could be using a second workflow (wkfl2) to maintain the workflow_dispatch (wkfl1) options. Something like the following sequence:

  • There is a text file 'dst.txt' in your repo with options [A, B, C].
  • Someone pushes option 'D' to 'dst.txt'.
  • wkfl2 runs, updating the list of options in wkfl1.
like image 41
jrbe228 Avatar answered Jun 28 '26 14:06

jrbe228