Closed amustill closed 3 years ago
php-actions/composer
runs a Docker container so your environment variable does not reach that.
Try simply running Composer
- name: "Install dependencies with Composer"
env:
ACF_PRO_KEY: "${{ secrets.ACF_PRO_KEY }}"
run: "composer update --no-interaction --no-progress"
Thanks for the response @szepeviktor.
This is my first attempt at using GitHub Actions (coming from GitLab CI) so apologise if I'm incorrect, but my understanding of the documentation is that passing the env
config to step will set it within it? Additionally the author of php-actions/composer
suggest this is also correct.
For the time being I have found a solution by adding an additional step before php-actions/composer
which dumps my global ACF_PRO_KEY
in to an .env
file. This installs the package without issue.
- name: Create .env
run: |
echo "ACF_PRO_KEY=$ACF_PRO_KEY" > .env
- name: Install dependencies
uses: php-actions/composer@v5
with:
php_version: '7.4'
Would this not counter your argument of the environment variable not being accessible to the Docker container?
I'm not entirely comfortable with this as a solution, but at the moment it appears to be the only way to get ffraenz/private-composer-installer
and php-actions/composer
to play nicely with each other.
but my understanding of the documentation is that passing the
env
config to step will set it within it
There is no problem with that. php-actions/composer will receive the env but php-actions/composer itself starts up a container and does not pass local env to that container.
Would this not counter your argument of the environment variable not being accessible to the Docker container?
I simply never used php-actions/composer.
Thanks again @szepeviktor.
Skipping php-actions/composer
and manually running Composer is certainly an option worth considering and is something I can investigate at a later date. For now the deployment is working at least.
I'll take the issue back to php-actions/composer
and close this once I've heard back.
The author of php-actions/composer
has confirmed it is a bug their end, so I'm closing this.
Has anyone successfully used this package with GitHub Actions? It appears to be as if environment variables are not ready correctly, resulting in failed deployments.
I'm attempting to use the
php-actions/composer
action, but however I set the environment variable I am constantly facingCan't resolve placeholder {%ACF_PRO_KEY}. Environment variable 'ACF_PRO_KEY' is not set.
errors.Configuring the
ACF_PRO_KEY
environment variable globally or even hard coding the value instead of using a secret doesn't work. I have an open issue on thephp-actions/composer
repository but the author has confirming the configuration is correct.Could this be related to how GitHub Actions exposes environment variables and this package reads them? For at the moment they do not appear to be compatible.