Skip to content

Commit

Permalink
Merge pull request #94 from tsuyoshicho/feature/diff-20201026
Browse files Browse the repository at this point in the history
  • Loading branch information
tsuyoshicho authored Oct 26, 2020
2 parents c2e2885 + 0556615 commit 694ce74
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/sh

cd "$GITHUB_WORKSPACE"
cd "$GITHUB_WORKSPACE" || true

export REVIEWDOG_GITHUB_API_TOKEN="${INPUT_GITHUB_TOKEN}"

Expand All @@ -24,4 +24,25 @@ npx textlint -f checkstyle "${INPUT_TEXTLINT_FLAGS:-.}" \
-reporter="${INPUT_REPORTER:-'github-pr-check'}" \
-level="${INPUT_LEVEL:-'error'}"

# github-pr-review only diff adding
if [ "${INPUT_REPORTER}" = "github-pr-review" ]; then
# fix
npx textlint --fix "${INPUT_TEXTLINT_FLAGS:-.}" || true

TMPFILE=$(mktemp)
git diff >"${TMPFILE}"

reviewdog \
-name="textlint-fix" \
-f=diff \
-f.diff.strip=1 \
-reporter="github-pr-review" \
-filter-mode="diff_context" \
-level="${INPUT_LEVEL:-'error'}" \
< "${TMPFILE}"

git restore . || true
rm -f "${TMPFILE}"
fi

# EOF

0 comments on commit 694ce74

Please sign in to comment.