From 2f4bbe97fb529f571538c1f25feba1895f865e6b Mon Sep 17 00:00:00 2001 From: Yossi Farjoun Date: Sat, 3 Apr 2021 15:54:46 -0400 Subject: [PATCH] parent 358af5c6001dda30d591259839082c864e16a385 author Yossi Farjoun 1617479686 -0400 committer Yossi Farjoun 1618455120 -0400 Change the way the script is run. instead of modfying the ENTRYPOINT, we will simply add the "shell" (default sh) and the "script_prefix" (default -c) and then the script. That way the possible comple entry point is not disturbed. if a user would like to remove the ENTRYPOINT they can provide an "option" "--entrypoint ''" for example. --- .github/workflows/tests.yml | 2 +- README.md | 2 +- action.yml | 4 ++++ entrypoint.sh | 2 +- 4 files changed, 7 insertions(+), 3 deletions(-) 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/README.md b/README.md index 8bdac31..15682c8 100644 --- a/README.md +++ b/README.md @@ -55,4 +55,4 @@ run: | echo "first line" echo "second line" -``` + diff --git a/action.yml b/action.yml index 7c1a8e6..ed8cba2 100644 --- a/action.yml +++ b/action.yml @@ -15,6 +15,10 @@ 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 registry: description: 'Registry' required: false diff --git a/entrypoint.sh b/entrypoint.sh index 39c1d70..020396a 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -8,4 +8,4 @@ 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'/;}" +exec docker run -v "/var/run/docker.sock":"/var/run/docker.sock" $INPUT_OPTIONS $INPUT_IMAGE $INPUT_SHELL $INPUT_SCRIPT_PREFIX "${INPUT_RUN//$'\n'/;}"