generated from reviewdog/action-template
-
Notifications
You must be signed in to change notification settings - Fork 15
/
entrypoint.sh
executable file
·47 lines (37 loc) · 1.43 KB
/
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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/bin/bash
set -eu # Increase bash strictness
shopt -s globstar # Enable globstar
if [[ -n "${GITHUB_WORKSPACE}" ]]; then
cd "${GITHUB_WORKSPACE}/${INPUT_WORKDIR}" || exit
fi
export REVIEWDOG_GITHUB_API_TOKEN="${INPUT_GITHUB_TOKEN}"
export REVIEWDOG_VERSION=v0.14.1
echo "[action-pylint] Installing reviewdog..."
wget -O - -q https://raw.githubusercontent.com/reviewdog/reviewdog/master/install.sh | sh -s -- -b /tmp "${REVIEWDOG_VERSION}"
if [[ "$(which pylint)" == "" ]]; then
echo "[action-pylint] Installing pylint package..."
python -m pip install --upgrade pylint
fi
echo "[action-pylint] pylint version:"
pylint --version
if [[ "$INPUT_PYLINT_RC" == "" ]]; then
# Do not supply the rcfile option if it is not provided
rcfile_option=""
else
rcfile_option="--rcfile=\"${INPUT_PYLINT_RC}\""
fi
echo "[action-pylint] Checking python code with the pylint linter and reviewdog..."
exit_val="0"
pylint --score n ${rcfile_option} ${INPUT_PYLINT_ARGS} ${INPUT_GLOB_PATTERN} 2>&1 | # Removes ansi codes see https://github.com/reviewdog/errorformat/issues/51
/tmp/reviewdog -efm="%f:%l:%c: %m" \
-name="${INPUT_TOOL_NAME}" \
-reporter="${INPUT_REPORTER}" \
-filter-mode="${INPUT_FILTER_MODE}" \
-fail-on-error="${INPUT_FAIL_ON_ERROR}" \
-level="${INPUT_LEVEL}" \
${INPUT_REVIEWDOG_FLAGS} || exit_val="$?"
echo "[action-pylint] Clean up reviewdog..."
rm /tmp/reviewdog
if [[ "${exit_val}" -ne '0' ]]; then
exit 1
fi