github-action-setup-ddev
github-action-setup-ddev copied to clipboard
Automatically set the CI environment variable to "true" within DDEV containers
We have several things that require the use of the CI environment variable, which is set to the string true inside Github Actions runners, but inside the DDEV container, this environment has to be manually set by us. It would be nice if this action could also do this for every site.
I wonder if we could also maybe just bring all of the Github action runner environment variables over as well to the web container.
You can just do that with a .env file if it's what you want.
I won't bring over all environment into the containers because that is messy. CI is also not something I like because it carries no real meaning :)
You can use $IS_DDEV_PROJECT to check if you are running from a DDEV container.
Setting environment variables in the ddev containers can be done by the usual DDEV means. This can be done by an action run before this action if you want it just when run inside Github actions.
Maybe it would be helpful if this action would set some environment variable (GITHUB_ACTION_DDEV ?) to make it easier for in-DDEV apps to discover that they are run from a GIthub action and within DDEV.
I haven't had the need for any specialities in DDEV projects when run as a GIthub action. What is it you want to achieve?
Well the reason I need this is due to https://github.com/jonaseberle/github-action-setup-ddev/issues/18. The ddev pull pantheon provider by default has a call to ssh-add that fails, because the container that contains the .ssh directory isn't mounted. So I needed to add logic via an environment variable that skips that call only when run in Github Actions, and not on everyone's local environments.
I am open to have a
ddev config global --web-environment-add="GITHUB_ACTION_DDEV=true" --instrumentation-opt-in=false --omit-containers=dba,ddev-ssh-agent
in https://github.com/jonaseberle/github-action-setup-ddev/blob/master/lib/main.js#L68 (untested)
In that case we should also mention it in the README.
Hey, we have moved to https://github.com/ddev/github-action-setup-ddev. This repo will be archived (read-only). I am going to close all issues. Please feel free to open a new one in the new place if you think it makes sense.