Skip to content

Commit 61d03c1

Browse files
authored
fix: Fail if npm ci fails (#25)
1 parent 7641977 commit 61d03c1

File tree

1 file changed

+20
-4
lines changed

1 file changed

+20
-4
lines changed

entrypoint.sh

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ function installNpmPackage(){
2020
elif [ "${INPUT_DEBUG_LOG}" == "true" ] && [ "$scope" == "global" ]; then
2121
sudo npm install -g $package
2222
elif [ "$scope" == "local" ]; then
23-
npm install $package --log-level=error --no-fund --no-audit $package >/dev/null 2>&1
23+
npm install $package --log-level=error --no-fund --no-audit $package >/dev/null
2424
else
25-
sudo npm install -g --log-level=error --no-fund --no-audit $package >/dev/null 2>&1
25+
sudo npm install -g --log-level=error --no-fund --no-audit $package >/dev/null
2626
fi
2727

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

44+
function npmCi(){
45+
if [ -e "package.json" ]; then
46+
echo "Run npm ci"
47+
if [ "${INPUT_DEBUG_LOG}" == "true" ]; then
48+
npm ci
49+
else
50+
npm ci --log-level=error --no-fund --no-audit >/dev/null
51+
fi
52+
53+
if [ "${?}" -ne 0 ]; then
54+
echo "Failed to run npm ci"
55+
else
56+
echo "Successful npm ci"
57+
fi
58+
fi
59+
}
60+
4461
function installPipRequirements(){
4562
if [ -e "requirements.txt" ]; then
4663
echo "Install requirements.txt"
@@ -97,8 +114,7 @@ ${output}
97114
function main(){
98115
parseInputs
99116
cd ${GITHUB_WORKSPACE}/${INPUT_WORKING_DIR}
100-
echo "run npm ci"
101-
npm ci
117+
npmCi
102118
installAwsCdk
103119
installPipRequirements
104120
runCdk ${INPUT_CDK_ARGS}

0 commit comments

Comments
 (0)