forked from alaegin/Detekt-Action
-
Notifications
You must be signed in to change notification settings - Fork 0
/
entrypoint.sh
executable file
·51 lines (38 loc) · 1.38 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
48
49
50
51
#!/bin/bash
detekt_formatting="/opt/detekt-formatting.jar"
# cd or fail
cd "$GITHUB_WORKSPACE" || exit 1
# Fixes https://github.com/reviewdog/reviewdog/issues/1158
git config --global --add safe.directory $GITHUB_WORKSPACE || exit 1
if [ "$INPUT_FAIL_ON_ERROR" = true ] ; then
set -o pipefail
fi
export REVIEWDOG_GITHUB_API_TOKEN="${INPUT_GITHUB_TOKEN}"
detekt_command="java -jar /opt/detekt.jar "
detekt_command+="--config ${INPUT_DETEKT_CONFIG} "
detekt_command+="--report xml:detekt_report.xml "
detekt_command+="--excludes ${INPUT_DETEKT_EXCLUDES} "
if [ -z "$INPUT_DETEKT_PLUGINS" ]; then
detekt_command+="--plugins ${detekt_formatting} "
else
detekt_command+="--plugins ${detekt_formatting},${INPUT_DETEKT_PLUGINS} "
fi
if [ -n "$INPUT_DETEKT_BASELINE" ]; then
detekt_command+="--baseline ${INPUT_DETEKT_BASELINE} "
fi
if [ -n "$INPUT_DETEKT_PARALLEL" ]; then
detekt_command+="--parallel "
fi
if [ -n "$DETEKT_INPUT_BUILD_UPON_DEFAULT_CONFIG" ]; then
detekt_command+="--build-upon-default-config "
fi
if [ -n "$DETEKT_ALL_RULES" ]; then
detekt_command+="--all-rules "
fi
if [ -n "$DETEKT_INPUT" ]; then
detekt_command+="--input ${DETEKT_INPUT} "
fi
echo "$detekt_command"
eval "$detekt_command"
reviewdog -f=checkstyle -name="detekt" -reporter="${INPUT_REVIEWDOG_REPORTER}" \
-level="${INPUT_REVIEWDOG_LEVEL}" -filter-mode="${INPUT_REVIEWDOG_FILTER}" <detekt_report.xml