forked from reviewdog/action-eslint
-
Notifications
You must be signed in to change notification settings - Fork 1
/
script.sh
executable file
·34 lines (27 loc) · 1.12 KB
/
script.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/bin/sh
cd "${GITHUB_WORKSPACE}/${INPUT_WORKDIR}" || exit 1
TEMP_PATH="$(mktemp -d)"
PATH="${TEMP_PATH}:$PATH"
export REVIEWDOG_GITHUB_API_TOKEN="${INPUT_GITHUB_TOKEN}"
ESLINT_FORMATTER="${GITHUB_ACTION_PATH}/eslint-formatter-rdjson/index.js"
echo '::group::🐶 Installing reviewdog ... https://github.com/reviewdog/reviewdog'
curl -sfL https://raw.githubusercontent.com/reviewdog/reviewdog/master/install.sh | sh -s -- -b "${TEMP_PATH}" "${REVIEWDOG_VERSION}" 2>&1
echo '::endgroup::'
if [ ! -f "$(npm bin)/eslint" ]; then
echo '::group:: Running `npm install` to install eslint ...'
npm install
echo '::endgroup::'
fi
echo "eslint version:$($(npm bin)/eslint --version)"
echo '::group:: Running eslint with reviewdog 🐶 ...'
$(npm bin)/eslint -f="${ESLINT_FORMATTER}" ${INPUT_ESLINT_FLAGS:-'.'} \
| reviewdog -f=rdjson \
-name="${INPUT_TOOL_NAME}" \
-reporter="${INPUT_REPORTER:-github-pr-review}" \
-filter-mode="${INPUT_FILTER_MODE}" \
-fail-on-error="${INPUT_FAIL_ON_ERROR}" \
-level="${INPUT_LEVEL}" \
${INPUT_REVIEWDOG_FLAGS}
reviewdog_rc=$?
echo '::endgroup::'
exit $reviewdog_rc