forked from reviewdog/action-eslint
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathentrypoint.sh
executable file
·24 lines (18 loc) · 983 Bytes
/
entrypoint.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
#!/bin/sh
cd "$GITHUB_WORKSPACE"
cd "$INPUT_MONO_REPO_DIR"
export REVIEWDOG_GITHUB_API_TOKEN="${INPUT_GITHUB_TOKEN}"
if [ ! -f "$(npm bin)/eslint" ]; then
npm install
fi
$(npm bin)/eslint --version
if [ "${INPUT_REPORTER}" == 'github-pr-review' ]; then
# Use jq and github-pr-review reporter to format result to include link to rule page.
$(npm bin)/eslint -f="json" ${INPUT_ESLINT_FLAGS:-'.'} \
| jq -r '.[] | {filePath: .filePath, messages: .messages[]} | "\(.filePath):\(.messages.line):\(.messages.column):\(.messages.message) [\(.messages.ruleId)](https://eslint.org/docs/rules/\(.messages.ruleId))"' \
| reviewdog -efm="%f:%l:%c:%m" -name="eslint" -reporter=github-pr-review -level="${INPUT_LEVEL}"
else
# github-pr-check,github-check (GitHub Check API) doesn't support markdown annotation.
$(npm bin)/eslint -f="stylish" ${INPUT_ESLINT_FLAGS:-'.'} \
| reviewdog -f="eslint" -reporter="${INPUT_REPORTER:-github-pr-check}" -level="${INPUT_LEVEL}"
fi