Skip to content

Commit

Permalink
Merge pull request #1 from EPMatt/reviewdog-custom-flags
Browse files Browse the repository at this point in the history
Support for severity levels and custom reviewdog flags
  • Loading branch information
DVDAndroid authored Nov 21, 2020
2 parents 9e23771 + 67768cb commit 14f30f9
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 3 deletions.
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# GitHub Action: Run Android Lint with reviewdog

This action runs [Andriod Lint](https://developer.android.com/studio/write/lint) with
This action runs [Android Lint](https://developer.android.com/studio/write/lint) with
[reviewdog](https://github.com/reviewdog/reviewdog).

## Inputs
Expand All @@ -24,6 +24,11 @@ The default is `error`.
Optional. Reporter of reviewdog command [`github-check`, `github-pr-check`,`github-pr-review`].
The default is `github-check`.

#### `reviewdog_flags`

Optional. Additional flags to be passed to reviewdog cli.
The default is ``.

## Example usage

[Example repo](https://github.com/DVDAndroid/action-android-lint-example)
Expand Down
6 changes: 6 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ inputs:
required: false
default: 'github-check'

reviewdog_flags:
description: 'Additional reviewdog flags'
required: false
default: ''

runs:
using: 'docker'
image: 'Dockerfile'
Expand All @@ -31,6 +36,7 @@ runs:
- ${{ inputs.lint_xml_file }}
- ${{ inputs.level }}
- ${{ inputs.reporter }}
- ${{ inputs.reviewdog_flags }}

branding:
icon: 'smartphone'
Expand Down
5 changes: 4 additions & 1 deletion converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,10 @@
else:
error.attrib['column'] = str(0)

error.attrib['severity'] = 'error'
if 'severity' in issue.attrib:
error.attrib['severity'] = issue.attrib['severity']
else:
error.attrib['severity'] = 'info'

issueId = issue.attrib['id']
message = issue.attrib['message']
Expand Down
2 changes: 1 addition & 1 deletion entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
export REVIEWDOG_GITHUB_API_TOKEN="${INPUT_GITHUB_TOKEN}"

python3 /usr/local/bin/converter.py $GITHUB_WORKSPACE/${INPUT_LINT_XML_FILE}
cat output_checkstyle.xml | reviewdog -f=checkstyle -name="Android Lint" -reporter="${INPUT_REPORTER}" -level="${INPUT_LEVEL}"
cat output_checkstyle.xml | reviewdog -f=checkstyle -name="Android Lint" -reporter="${INPUT_REPORTER}" -level="${INPUT_LEVEL}" ${INPUT_REVIEWDOG_FLAGS}

0 comments on commit 14f30f9

Please sign in to comment.