How to pass environment variable received from GitHub actions
I think you are trying to read the wrong environment variable name. GitHub Actions adds INPUT_
to the name of the input variable. So try the following:
print(os.getenv('INPUT_TEST_VAR'))
From the documentation:
When you specify an input to an action in a workflow file or use a default input value, GitHub creates an environment variable for the input with the name INPUT_. The environment variable created converts input names to uppercase letters and replaces spaces with _ characters.
For example, if a workflow defined the numOctocats and octocatEyeColor inputs, the action code could read the values of the inputs using the INPUT_NUMOCTOCATS and INPUT_OCTOCATEYECOLOR environment variables.
https://help.github.com/en/articles/metadata-syntax-for-github-actions#inputs
A bit late but for the next one, you can also use the env
field :
name: CIon: [push]jobs: build:runs-on: ubuntu-lateststeps: - name: Test the GH action uses: paramt/github-actions-playground@master env: test_var: "this is just a test"
which will be included during the creation of your docker and pass without the prefix INPUT_