-
-
Notifications
You must be signed in to change notification settings - Fork 12
/
entrypoint.sh
executable file
·43 lines (34 loc) · 1.16 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
#!/bin/sh
cd "${GITHUB_WORKSPACE}" || exit 1
git config --global --add safe.directory "${GITHUB_WORKSPACE}" || exit 1
export REVIEWDOG_GITHUB_API_TOKEN="${INPUT_GITHUB_TOKEN}"
# shellcheck disable=SC2086
markdownlint ${INPUT_MARKDOWNLINT_FLAGS:-.} 2>&1 \
| reviewdog \
-efm="%f:%l:%c %m" \
-efm="%f:%l %m" \
-name="markdownlint" \
-reporter="${INPUT_REPORTER:-github-pr-check}" \
-filter-mode="${INPUT_FILTER_MODE}" \
-fail-on-error="${INPUT_FAIL_ON_ERROR}" \
-level="${INPUT_LEVEL}" \
${INPUT_REVIEWDOG_FLAGS} || EXIT_CODE=$?
# github-pr-review only diff adding
if [ "${INPUT_REPORTER}" = "github-pr-review" ]; then
# fix
markdownlint --fix ${INPUT_MARKDOWNLINT_FLAGS:-.} 2>&1 || true
TMPFILE=$(mktemp)
git diff > "${TMPFILE}"
git stash -u
# shellcheck disable=SC2086
reviewdog \
-f=diff \
-f.diff.strip=1 \
-name="markdownlint-fix" \
-reporter="github-pr-review" \
-filter-mode="diff_context" \
-level="${INPUT_LEVEL}" \
${INPUT_REVIEWDOG_FLAGS} < "${TMPFILE}"
git stash drop || true
fi
exit ${EXIT_CODE}