From 95bb906cc99080d076eec9e785ad7f80639a0d7c Mon Sep 17 00:00:00 2001 From: Tsuyoshi CHO Date: Tue, 12 May 2020 22:07:35 +0900 Subject: [PATCH] use npm ls --- entrypoint.sh | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index 33e3cce..1ee4d84 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -5,16 +5,19 @@ cd "$GITHUB_WORKSPACE" export REVIEWDOG_GITHUB_API_TOKEN="${INPUT_GITHUB_TOKEN}" # nothing command, try project package install -if [ ! -f "$(npm bin)/textlint" ]; then +if npm ls textlint &> /dev/null; then + # pass + : +else npm install fi # nothing command in after install, use command direct install PACKAGE="" -if [ ! -f "$(npm bin)/textlint" ]; then +if npm ls textlint &> /dev/null; then + npx textlint --version +else PACKAGE="-p textlint@${INPUT_TEXTLINT_VERSION:-11.6.3}" echo textlint direct install version: ${INPUT_TEXTLINT_VERSION:-11.6.3} -else - npx textlint --version fi npx ${PACKAGE} textlint -f checkstyle "${INPUT_TEXTLINT_FLAGS:-.}" \