with
context with field names containing '-' create POSIX-uncompliant variables
#219
Labels
bug
Something isn't working
Describe the bug
Environmental variables provided to a docker action through
with
that contain a '-' are not easily accessible, and are moreover not POSIX-compliantTo Reproduce
Consider
We note that the docker command invoked is something like
/usr/bin/docker run --name e4e3a71d2cda2576d484cb8eef9019d724e5d_93f69a --label 2e4e3a --workdir /github/workspace --rm -e INPUT_WORKING-DIRECTORY -e INPUT_OTHER -e HOME -e GITHUB_REF -e GITHUB_SHA -e GITHUB_REPOSITORY -e GITHUB_ACTOR -e GITHUB_WORKFLOW -e GITHUB_HEAD_REF -e GITHUB_BASE_REF -e GITHUB_EVENT_NAME -e GITHUB_WORKSPACE -e GITHUB_ACTION -e GITHUB_EVENT_PATH -e RUNNER_OS -e RUNNER_TOOL_CACHE -e RUNNER_TEMP -e RUNNER_WORKSPACE -e ACTIONS_RUNTIME_URL -e ACTIONS_RUNTIME_TOKEN -e GITHUB_ACTIONS=true -v "/var/run/docker.sock":"/var/run/docker.sock" -v "/home/runner/work/_temp/_github_home":"/github/home" -v "/home/runner/work/_temp/_github_workflow":"/github/workflow" -v "/home/runner/work/dir/dir":"/github/workspace" 2e4e3a:71d2cda2576d484cb8eef9019d724e5d test //dir:all
and env as expected is something like
Here's a stack exchange on why this isn't good: https://stackoverflow.com/questions/36989263/why-cant-environment-variables-with-dashes-be-accessed-in-bash-4-1-2
Expected behavior
It would be nice if you provided a warning that a bad variable was supplied to the environment, OR sub '-' with '_' (this would be much more preferable)
Additional context
You can potentially grep
env
to capture this variable inbash
. Note thatsh
drops the variable all together. I think this is potentially a design choice on your part. Functionality is as expected but requires a work around to be viable.The text was updated successfully, but these errors were encountered: