Skip to content

Commit

Permalink
Merge pull request #13 from reviewdog/reviewdog_flags
Browse files Browse the repository at this point in the history
Add reviewdog_flags & workdir input
  • Loading branch information
haya14busa committed May 8, 2020
2 parents b119d33 + a555e1e commit 2ee535f
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 4 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@ jobs:
with:
github_token: ${{ secrets.github_token }}
reporter: github-pr-check
level: error
level: warning
locale: "US"
workdir: ./testdata/subdir/

test-pr-review:
if: github.event_name == 'pull_request'
Expand All @@ -42,3 +43,4 @@ jobs:
reporter: github-pr-review
level: error
locale: "US"
reviewdog_flags: -filter-mode=file -fail-on-error
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ inputs:
reporter:
description: 'Reporter of reviewdog command [github-pr-check,github-check,github-pr-review].'
default: 'github-pr-check'
reviewdog_flags:
description: 'Additional reviewdog flags'
default: ''
### Flags for <linter-name> ###
locale:
description: '-locale flag of misspell. (US/UK)'
Expand Down
6 changes: 6 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,19 @@ inputs:
github_token:
description: 'GITHUB_TOKEN'
default: '${{ github.token }}'
workdir:
description: 'Working directory relative to the root directory.'
default: '.'
### Flags for reviewdog ###
level:
description: 'Report level for reviewdog [info,warning,error]'
default: 'error'
reporter:
description: 'Reporter of reviewdog command [github-pr-check,github-pr-review].'
default: 'github-pr-check'
reviewdog_flags:
description: 'Additional reviewdog flags'
default: ''
### Flags for <linter-name> ###
locale:
description: '-locale flag of misspell. (US/UK)'
Expand Down
10 changes: 7 additions & 3 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
#!/bin/sh
set -e

if [ -n "${GITHUB_WORKSPACE}" ]; then
cd "${GITHUB_WORKSPACE}" || exit
if [ -n "${GITHUB_WORKSPACE}" ] && [ -n "${INPUT_WORKDIR}" ]; then
cd "${GITHUB_WORKSPACE}/${INPUT_WORKDIR}" || exit
fi

export REVIEWDOG_GITHUB_API_TOKEN="${INPUT_GITHUB_TOKEN}"

misspell -locale="${INPUT_LOCALE}" . \
| reviewdog -efm="%f:%l:%c: %m" -name="linter-name (misspell)" -reporter="${INPUT_REPORTER:-github-pr-check}" -level="${INPUT_LEVEL}"
| reviewdog -efm="%f:%l:%c: %m" \
-name="linter-name (misspell)" \
-reporter="${INPUT_REPORTER:-github-pr-check}" \
-level="${INPUT_LEVEL}" \
${INPUT_REVIEWDOG_FLAGS}
2 changes: 2 additions & 0 deletions testdata/subdir/text.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Determinisitic result is important!

2 changes: 2 additions & 0 deletions testdata/text.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
Determinisitic result is important.

colour # <= Check -locale

langauge

0 comments on commit 2ee535f

Please sign in to comment.