diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 66589bc..ff552af 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -3,7 +3,7 @@ name: Docker Run Action Tests on: push: branches: - - main + - '**' pull_request: jobs: diff --git a/action.yml b/action.yml index 7c1a8e6..a508c3b 100644 --- a/action.yml +++ b/action.yml @@ -15,6 +15,14 @@ inputs: description: 'Use a specific shell' required: false default: sh + script_prefix: + description: 'A prefix telling the shell to execute the following (single) string as a script' + required: false + default: -c + quote_argument: + description: 'Whether to quote the arguments when providing them to the docker as input' + required: false + default: true registry: description: 'Registry' required: false diff --git a/entrypoint.sh b/entrypoint.sh index 39c1d70..52ea7cd 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -8,4 +8,10 @@ if [ ! -z $INPUT_DOCKER_NETWORK ]; then INPUT_OPTIONS="$INPUT_OPTIONS --network $INPUT_DOCKER_NETWORK" fi -exec docker run -v "/var/run/docker.sock":"/var/run/docker.sock" $INPUT_OPTIONS --entrypoint=$INPUT_SHELL $INPUT_IMAGE -c "${INPUT_RUN//$'\n'/;}" +if [ $INPUT_QUOTE_ARGUMENT = "true" ]; +then exec docker run -v "/var/run/docker.sock":"/var/run/docker.sock" $INPUT_OPTIONS $INPUT_IMAGE $INPUT_SHELL $INPUT_SCRIPT_PREFIX "${INPUT_RUN//$'\n'/;}" +elif [ $INPUT_QUOTE_ARGUMENT = "false" ]; then exec docker run -v "/var/run/docker.sock":"/var/run/docker.sock" $INPUT_OPTIONS $INPUT_IMAGE $INPUT_SHELL $INPUT_SCRIPT_PREFIX ${INPUT_RUN} +else + echo "Sorry, please specify 'true' or 'false' for the variable quote_argument" + exit 1 +fi