In my action.yml I defined an input:
name: 'test action' author: Param Thakkar description: 'test' inputs: test_var: description: 'A test variable' required: true runs: using: 'docker' image: 'Dockerfile'
And in my workflow I passed the test_var:
name: CI on: [push] jobs: build: runs-on: ubuntu-latest steps: - name: Test the GH action uses: paramt/github-actions-playground@master with: test_var: "this is just a test"
So there should be an environment variable that’s created when the workflow runs, right? But when I run this short python script:
import os print(os.getenv('TEST_VAR')) print("It works!") exit(0)
None It works!
Do I have to pass the env variable to my python script through the Dockerfile? Right now my Dockerfile looks like this:
FROM python:latest ADD entrypoint.py /entrypoint.py ADD requirements.txt /requirements.txt RUN echo "$TEST_VAR" RUN pip install -r requirements.txt RUN chmod +x entrypoint.py ENTRYPOINT ["/entrypoint.py"]
Any help is appreciated. Here’s the link to the repo