Skip to content

Commit

Permalink
fix: Fail if npm ci fails (#25)
Browse files Browse the repository at this point in the history
  • Loading branch information
mrmeyers99 authored Jan 4, 2022
1 parent 7641977 commit 61d03c1
Showing 1 changed file with 20 additions and 4 deletions.
24 changes: 20 additions & 4 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ function installNpmPackage(){
elif [ "${INPUT_DEBUG_LOG}" == "true" ] && [ "$scope" == "global" ]; then
sudo npm install -g $package
elif [ "$scope" == "local" ]; then
npm install $package --log-level=error --no-fund --no-audit $package >/dev/null 2>&1
npm install $package --log-level=error --no-fund --no-audit $package >/dev/null
else
sudo npm install -g --log-level=error --no-fund --no-audit $package >/dev/null 2>&1
sudo npm install -g --log-level=error --no-fund --no-audit $package >/dev/null
fi

if [ "${?}" -ne 0 ]; then
Expand All @@ -41,6 +41,23 @@ function installAwsCdk(){
fi
}

function npmCi(){
if [ -e "package.json" ]; then
echo "Run npm ci"
if [ "${INPUT_DEBUG_LOG}" == "true" ]; then
npm ci
else
npm ci --log-level=error --no-fund --no-audit >/dev/null
fi

if [ "${?}" -ne 0 ]; then
echo "Failed to run npm ci"
else
echo "Successful npm ci"
fi
fi
}

function installPipRequirements(){
if [ -e "requirements.txt" ]; then
echo "Install requirements.txt"
Expand Down Expand Up @@ -97,8 +114,7 @@ ${output}
function main(){
parseInputs
cd ${GITHUB_WORKSPACE}/${INPUT_WORKING_DIR}
echo "run npm ci"
npm ci
npmCi
installAwsCdk
installPipRequirements
runCdk ${INPUT_CDK_ARGS}
Expand Down

0 comments on commit 61d03c1

Please sign in to comment.