Skip to content

Commit

Permalink
Merge pull request #5 from reviewdog/fix
Browse files Browse the repository at this point in the history
Fix markdownlint
  • Loading branch information
haya14busa committed Dec 30, 2020
2 parents a1c34a4 + a81a408 commit a506383
Show file tree
Hide file tree
Showing 6 changed files with 82 additions and 33 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/reviewdog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,10 @@ jobs:
github_token: ${{ secrets.GITHUB_TOKEN }}
reporter: github-check
level: warning
filter_mode: nofilter

- name: markdownlint-github-pr-review
uses: ./
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
reporter: github-pr-review
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
FROM prologic/markdownlint:latest

RUN wget -O - -q https://raw.githubusercontent.com/reviewdog/reviewdog/master/install.sh| sh -s -- -b /usr/local/bin/ v0.9.15
RUN wget -O - -q https://raw.githubusercontent.com/reviewdog/reviewdog/master/install.sh \
| sh -s -- -b /usr/local/bin/ v0.11.0
RUN apk --no-cache -U add git

COPY entrypoint.sh /entrypoint.sh
Expand Down
52 changes: 32 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,36 @@ code review experience.

## Inputs

### `github_token`

**Required**. Must be in form of `github_token: ${{ secrets.github_token }}`'.

### `level`

Optional. Report level for reviewdog [info,warning,error].
It's same as `-level` flag of reviewdog.

### `reporter`

Reporter of reviewdog command [github-pr-check,github-pr-review,github-check].
Default is github-pr-check.
github-pr-review can use Markdown and add a link to rule page in reviewdog reports.

### `markdownlint_flags`

Optional. Flags of markdownlint command. Default: `.`
```yml
inputs:
github_token:
description: 'GITHUB_TOKEN.'
required: true
### Flags for reviewdog ###
level:
description: 'Report level for reviewdog [info,warning,error]'
default: 'error'
reporter:
description: 'Reporter of reviewdog command [github-check,github-pr-review].'
default: 'github-check'
filter_mode:
description: |
Filtering mode for the reviewdog command [added,diff_context,file,nofilter].
Default is added.
default: 'added'
fail_on_error:
description: |
Exit code for reviewdog when errors are found [true,false]
Default is `false`.
default: 'false'
reviewdog_flags:
description: 'Additional reviewdog flags'
default: ''
### Flags for markdownlint-cli ###
markdownlint_flags:
description: "Options of markdownlint-cli command. Default: '.'"
default: '.'
```
## Example usage
Expand All @@ -44,8 +56,8 @@ jobs:
steps:
- uses: actions/checkout@v1
- name: markdownlint
uses: prologic/action-markdownlint@v1
uses: reviewdog/action-markdownlint@v0.1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
reporter: github-pr-review # Change reporter. (Only `github-pr-check` is supported at the moment).
reporter: github-pr-review
```
14 changes: 14 additions & 0 deletions _testdata/test.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# test_markdownlint







## # blub
* abc
* abc
1. b


22 changes: 17 additions & 5 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,29 @@ inputs:
github_token:
description: 'GITHUB_TOKEN.'
required: true
### Flags for reviewdog ###
level:
description: 'Report level for reviewdog [info,warning,error]'
default: 'error'
reporter:
description: 'Reporter of reviewdog command [github-check,github-pr-review].'
default: 'github-check'
filter_mode:
description: |
Reporter of reviewdog command [github-pr-check,github-pr-review,github-check].
Default is github-pr-check.
github-pr-review can use Markdown and add a link to rule page in reviewdog reports.
default: 'github-pr-check'
Filtering mode for the reviewdog command [added,diff_context,file,nofilter].
Default is added.
default: 'added'
fail_on_error:
description: |
Exit code for reviewdog when errors are found [true,false]
Default is `false`.
default: 'false'
reviewdog_flags:
description: 'Additional reviewdog flags'
default: ''
### Flags for markdownlint-cli ###
markdownlint_flags:
description: "Options of markdownlint command. Default: '.'"
description: "Options of markdownlint-cli command. Default: '.'"
default: '.'
runs:
using: 'docker'
Expand Down
17 changes: 10 additions & 7 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,13 @@ cd "${GITHUB_WORKSPACE}" || exit

export REVIEWDOG_GITHUB_API_TOKEN="${INPUT_GITHUB_TOKEN}"

if [ "${INPUT_REPORTER}" = x"github-pr-review" ]; then
markdownlint "${INPUT_MARKDOWNLINT_FLAGS:-.}" |
reviewdog -efm="%s:%l:%c %m" -name="markdownlint" -diff="git diff HEAD^" -reporter=github-pr-review -level="${INPUT_LEVEL}" -tee
else
markdownlint "${INPUT_MARKDOWNLINT_FLAGS:-.}" |
reviewdog -efm="%f:%l:%c %m" -name="markdownlint" -diff="git diff HEAD^" -reporter=github-pr-check -level="${INPUT_LEVEL}" -tee
fi
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}

0 comments on commit a506383

Please sign in to comment.