Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Docker Run Action Tests
on:
push:
branches:
- main
- '**'
pull_request:

jobs:
Expand Down
8 changes: 8 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 7 additions & 1 deletion entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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