CustomPiOS icon indicating copy to clipboard operation
CustomPiOS copied to clipboard

How to pass GitHub workflow variables to CustomPiOS scripts

Open cooked opened this issue 4 years ago • 3 comments

Hi, as per the title I'd like define a variable in the GitHub worflow (and changing with something like strategy.matrix) and pass it down to the CustomPiOS scripts. While I can define the variable no problem, it seems I'm not able to read it properly from one bash script that is part of the filesystem I'm building. Is it possible? If so, how?

Thanks in advance.

cooked avatar Jun 28 '21 13:06 cooked

In what phase are you trying to read it?

  1. Make sure to export it.
  2. Note that modules only export values starting with their name, eg the base module variables start with ${BASE_...}. Behavior coded here (related to how compgen works): https://github.com/guysoft/CustomPiOS/blob/devel/src/config#L105

guysoft avatar Jun 28 '21 16:06 guysoft

@guysoft

  1. I'm setting up the workflow as follow:

image

image

then in the config file I'd like to use that variable to select only a subset of the modules available under src/modules

image

  1. I believe I'm not in that scenario since the variable is used before entering the modules, am I wrong?

cooked avatar Jun 30 '21 14:06 cooked

I think the best way is to add what you want to config.local. You can see how it can be used in this part of a github action: https://github.com/guysoft/OctoPi/blob/devel/.github/workflows/build.yml#L41

guysoft avatar Jun 30 '21 16:06 guysoft