diff --git a/action.yml b/action.yml index abfd1ff..f60b815 100644 --- a/action.yml +++ b/action.yml @@ -17,6 +17,9 @@ inputs: github_package_registry_token: description: "Github package registry token to install dependencies outside of npm" default: "" + directory: + description: "directory in which to execute sam command." + default: "./" runs: using: "docker" image: "./Dockerfile" diff --git a/entrypoint.sh b/entrypoint.sh index 1b48168..7fb6b30 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -67,9 +67,24 @@ ${output} fi } +function gotoDirectory(){ + if [ -z "${INPUT_DIRECTORY}" ]; then + return 1 + fi + + if [ ! -d "${INPUT_DIRECTORY}" ]; then + echo "Directory ${INPUT_DIRECTORY} does not exists." + exit 127 + fi + + echo "cd ${INPUT_DIRECTORY}" + cd $INPUT_DIRECTORY +} + function main(){ parseInputs installAwsSam + gotoDirectory runSam }