Passing environment variables to docker?
kx1s opened this issue · 1 comments
How do I pass environment variables over to docker. I have github secrets that hold API keys. I have tried this but my php scripts fail since there is no environment variables set in docker.
steps:
- uses: actions/checkout@v2
- uses: php-actions/composer@master
- name: PHPUnit Tests
uses: php-actions/phpunit@v2
env:
APIKEY: ${{ secrets.GO_APIKEY }}
with:
bootstrap: vendor/autoload.php
configuration: tests/phpunit.xml
args: --coverage-text
php_version: 7.4
version: 9.5.0
Hey @kx1s ,
It looks like you're using the Workflow syntax correctly, so I think the issue might be how you're using the secrets. Is there a way you can debug the content of the secret, to make sure it's getting the value passed correctly?
To help out, I've just added a unit test to the example-phpunit repository that sets an environment variable in the same way you are, and then uses PHPUnit to assert the value is available in PHP.
The env var is set here: https://github.com/php-actions/example-phpunit/blob/master/.github/workflows/ci.yml#L16-L17
The unit test is here: https://github.com/php-actions/example-phpunit/blob/master/test/EnvGreeterTest.php#L13-L19
And you can see the action passing successfully here: https://github.com/php-actions/example-phpunit/runs/2430940364?check_suite_focus=true
I'm going to close the issue for now, as the usage of env
seems to be working, but if you're still having problems feel free to open it again or carry on the conversation here. I'm happy to help out debugging your issue.
Cheers,
Greg.