-
Notifications
You must be signed in to change notification settings - Fork 100
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Problem passing github environment variables #25
Comments
I'm also wondering how to provide the env to the container. The
The only env present were those in the Dockerfile. I also tried this:
The first EXAMPLE works by itself but the second -e will get "docker: invalid reference format." The PR #23 solves this issue. Is there anything I can do to speed up the merge there? |
This is an old issue, but since it took me a while to figure out, I am writing an answer here. I believe there are two issues between the two comments here. First is that when you are forwarding the env, you don't need to assign it. Second is that you should use the - name: Printenv
uses: addnab/docker-run-action@v3
with:
image: user/repo
options: -e EXAMPLE=value -e SECRET
run: printenv
env:
SECRET: ${{ env.SECRET }} See here: #19 (comment)_ |
@kamiyo solution worked for me, but I had to use - name: Pull and Run the automation container
uses: addnab/docker-run-action@v3
with:
# username: ${{ secrets.DOCKER_USERNAME }}
# password: ${{ secrets.DOCKER_PASSWORD }}
registry: gcr.io
image: ${{ github.repository }}:latest
options: >-
--hostname 'actions'
--domainname 'runner.github.com'
--user root
--env TZ=America/Chicago
--env KEY
--env DISCORD_WEBHOOK_URL
--env TRACE=TRUE
--env APP_DEBUG=TRUE
-v ${{ github.workspace }}/latest_logs:/app/latest_logs:rw
-v ${{ github.workspace }}/question_Source:/app/questionSource:rw
run: python3 main.py
env:
KEY: ${{ secrets.APP_CS_KEY }}
DISCORD_WEBHOOK_URL: ${{ secrets.APP_DISCORD_WEBHOOK_URL }} |
I did not remembered this issue existed. I have found the solution just a few months ago. github environment variables can't be referenced with the env. prefix, instead the right way is using the github. instead, like this:
Here is the related documentation. |
Hi, I'm trying to pass some github predefined environment variables.
I've tried passing the variables as:
but the variables are empty inside the container. Then tried
but it just pass the text as-is without interpreting the variables. Then tried creating a heredoc in a previous step
the contents of export_env.sh is
when importing set_env.sh in the container
the file set_env.sh doesn't exists inside the container.
Then, how I pass those variables to the container?
The text was updated successfully, but these errors were encountered: