-
-
Notifications
You must be signed in to change notification settings - Fork 9
/
entrypoint.sh
executable file
·29 lines (24 loc) · 1.04 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
#!/bin/bash
set -eu # Increase bash error strictness
if [[ -n "${GITHUB_WORKSPACE}" ]]; then
cd "${GITHUB_WORKSPACE}/${INPUT_WORKDIR}" || exit
fi
export REVIEWDOG_GITHUB_API_TOKEN="${INPUT_GITHUB_TOKEN}"
echo "[action-remark-lint] Versions: $(remark --version), remark-lint: $(npm remark-lint --version)"
# Install plugins if package.sjon file is present
if [[ -f "package.json" ]]; then
echo "[action-remark-lint] Installing npm dependencies..."
npm install
fi
# NOTE: ${VAR,,} Is bash 4.0 syntax to make strings lowercase.
echo "[action-remark-lint] Checking markdown code with the remark-lint linter and reviewdog..."
remark --use=remark-preset-lint-recommended . ${INPUT_REMARK_ARGS} 2>&1 |
sed 's/\x1b\[[0-9;]*m//g' | # Removes ansi codes see https://github.com/reviewdog/errorformat/issues/51
reviewdog -f=remark-lint \
-name="${INPUT_TOOL_NAME}" \
-reporter="${INPUT_REPORTER}" \
-filter-mode="${INPUT_FILTER_MODE}" \
-fail-on-error="${INPUT_FAIL_ON_ERROR}" \
-level="${INPUT_LEVEL}" \
-tee \
${INPUT_REVIEWDOG_FLAGS}