-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
script.sh
executable file
·56 lines (46 loc) · 1.81 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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/bin/sh
set -e -u
cd "${GITHUB_WORKSPACE}" || exit 1
TEMP_PATH="$(mktemp -d)"
PATH="${TEMP_PATH}:$PATH"
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::'
echo '::group::⚡️ Installing dotenv-linter ... https://github.com/dotenv-linter/dotenv-linter'
curl -sSfL https://raw.githubusercontent.com/dotenv-linter/dotenv-linter/master/install.sh \
| sh -s -- -b "${TEMP_PATH}" "${DOTENV_LINTER_VERSION}" 2>&1
echo '::endgroup::'
export REVIEWDOG_GITHUB_API_TOKEN="${INPUT_GITHUB_TOKEN}"
if [ "${INPUT_REPORTER}" = "github-code-suggestions" ]
then
echo '::group::Running ⚡️ dotenv-linter with code suggestions 🐶 ...'
# shellcheck disable=SC2086
dotenv-linter fix --no-color ${INPUT_DOTENV_LINTER_FLAGS}
TMPFILE=$(mktemp)
git diff > "${TMPFILE}"
git stash -u || true
git stash drop || true
# shellcheck disable=SC2086
reviewdog \
-name="${INPUT_TOOL_NAME}" \
-f=diff \
-f.diff.strip=1 \
-reporter="github-pr-review" \
-filter-mode="${INPUT_FILTER_MODE}" \
-fail-on-error="${INPUT_FAIL_ON_ERROR}" \
${INPUT_REVIEWDOG_FLAGS} < "${TMPFILE}"
else
echo '::group::Running ⚡️ dotenv-linter with reviewdog 🐶 ...'
# shellcheck disable=SC2086
dotenv-linter --quiet --no-color ${INPUT_DOTENV_LINTER_FLAGS} \
| reviewdog -f=dotenv-linter \
-name="${INPUT_TOOL_NAME}" \
-reporter="${INPUT_REPORTER}" \
-filter-mode="${INPUT_FILTER_MODE}" \
-fail-on-error="${INPUT_FAIL_ON_ERROR}" \
${INPUT_REVIEWDOG_FLAGS}
fi
EXIT_CODE=$?
echo '::endgroup::'
exit ${EXIT_CODE}