-
-
Notifications
You must be signed in to change notification settings - Fork 27
/
Copy pathentrypoint.sh
executable file
·38 lines (30 loc) · 1.11 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
#!/bin/bash
cd "${GITHUB_WORKSPACE}" || exit 1
git config --global --add safe.directory $GITHUB_WORKSPACE || exit 1
export REVIEWDOG_GITHUB_API_TOKEN="${INPUT_GITHUB_TOKEN}"
paths=()
while read -r pattern; do
[[ -n ${pattern} ]] && paths+=("${pattern}")
done <<< "${INPUT_PATH:-.}"
names=()
if [[ "${INPUT_PATTERN:-*}" != '*' ]]; then
while read -r pattern; do
[[ -n ${pattern} ]] && names+=(-o -name "${pattern}")
done <<< "${INPUT_PATTERN}"
(( ${#names[@]} )) && { names[0]='('; names+=(')'); }
fi
excludes=()
while read -r pattern; do
[[ -n ${pattern} ]] && excludes+=(-not -path "${pattern}")
done <<< "${INPUT_EXCLUDE:-}"
find "${paths[@]}" "${excludes[@]}" -type f "${names[@]}" -print0 \
| xargs -0 misspell -locale="${INPUT_LOCALE}" -i "${INPUT_IGNORE}" \
| reviewdog -efm="%f:%l:%c: %m" \
-filter-mode="${INPUT_FILTER_MODE:-added}" \
-name="misspell" \
-reporter="${INPUT_REPORTER:-github-pr-check}" \
-level="${INPUT_LEVEL}" \
-fail-level="${INPUT_FAIL_LEVEL}" \
-fail-on-error="${INPUT_FAIL_ON_ERROR}"
exit_code=$?
exit $exit_code