From d28725e076b2ff10d836537a384dd3bc7775a207 Mon Sep 17 00:00:00 2001 From: Linas Daneliukas Date: Fri, 9 Jul 2021 11:19:53 +0300 Subject: [PATCH 1/4] Mount the workspace and set as default workdir --- action.yml | 4 ++++ entrypoint.sh | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/action.yml b/action.yml index 7c1a8e6..f00a4d4 100644 --- a/action.yml +++ b/action.yml @@ -8,6 +8,10 @@ inputs: options: description: 'Options' required: false + workidr: + description: 'Workdir for the container' + required: false + default: ${{ github.workspace }} run: description: 'Run command in container' required: false diff --git a/entrypoint.sh b/entrypoint.sh index 39c1d70..7b6f792 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 --workdir $INPUT_WORKDIR -v "/var/run/docker.sock:/var/run/docker.sock" -v "$GITHUB_WORKSPACE:$GITHUB_WORKSPACE" $INPUT_OPTIONS --entrypoint=$INPUT_SHELL $INPUT_IMAGE -c "${INPUT_RUN//$'\n'/;}" From 7ebe7c227ed676a91ac1cdae9041cbc2cb19cf43 Mon Sep 17 00:00:00 2001 From: Linas Daneliukas Date: Fri, 9 Jul 2021 11:33:42 +0300 Subject: [PATCH 2/4] remove workspace volume from example --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index eab5a93..0d29813 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ password: ${{ secrets.DOCKER_PASSWORD }} registry: gcr.io image: private-image:latest - options: -v ${{ github.workspace }}:/work -e ABC=123 + options: -e ABC=123 run: | echo "Running Script" /work/run-script From aeee02d5efcd807fa8bf90a55613f0b0796d0486 Mon Sep 17 00:00:00 2001 From: Linas Daneliukas Date: Fri, 9 Jul 2021 11:58:47 +0300 Subject: [PATCH 3/4] Fix typo --- action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yml b/action.yml index f00a4d4..d7c58c9 100644 --- a/action.yml +++ b/action.yml @@ -8,7 +8,7 @@ inputs: options: description: 'Options' required: false - workidr: + workdir: description: 'Workdir for the container' required: false default: ${{ github.workspace }} From 2088b428070dab585be44df889922810ac1da15e Mon Sep 17 00:00:00 2001 From: Linas Daneliukas Date: Fri, 9 Jul 2021 15:12:27 +0300 Subject: [PATCH 4/4] Set the correct default workspace for the repo --- action.yml | 2 +- entrypoint.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/action.yml b/action.yml index d7c58c9..c348541 100644 --- a/action.yml +++ b/action.yml @@ -11,7 +11,7 @@ inputs: workdir: description: 'Workdir for the container' required: false - default: ${{ github.workspace }} + default: /github/workspace/${{ github.event.repository.name }} run: description: 'Run command in container' required: false diff --git a/entrypoint.sh b/entrypoint.sh index 7b6f792..dd1ea64 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 --workdir $INPUT_WORKDIR -v "/var/run/docker.sock:/var/run/docker.sock" -v "$GITHUB_WORKSPACE:$GITHUB_WORKSPACE" $INPUT_OPTIONS --entrypoint=$INPUT_SHELL $INPUT_IMAGE -c "${INPUT_RUN//$'\n'/;}" +exec docker run --workdir "$INPUT_WORKDIR" -v "/var/run/docker.sock:/var/run/docker.sock" -v "$RUNNER_WORKSPACE:/github/workspace" $INPUT_OPTIONS --entrypoint=$INPUT_SHELL $INPUT_IMAGE -c "${INPUT_RUN//$'\n'/;}"