Skip to content

Commit 14f30f9

Browse files
authored
Merge pull request #1 from EPMatt/reviewdog-custom-flags
Support for severity levels and custom reviewdog flags
2 parents 9e23771 + 67768cb commit 14f30f9

File tree

4 files changed

+17
-3
lines changed

4 files changed

+17
-3
lines changed

README.md

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# GitHub Action: Run Android Lint with reviewdog
22

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

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

27+
#### `reviewdog_flags`
28+
29+
Optional. Additional flags to be passed to reviewdog cli.
30+
The default is ``.
31+
2732
## Example usage
2833

2934
[Example repo](https://github.com/DVDAndroid/action-android-lint-example)

action.yml

+6
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@ inputs:
2323
required: false
2424
default: 'github-check'
2525

26+
reviewdog_flags:
27+
description: 'Additional reviewdog flags'
28+
required: false
29+
default: ''
30+
2631
runs:
2732
using: 'docker'
2833
image: 'Dockerfile'
@@ -31,6 +36,7 @@ runs:
3136
- ${{ inputs.lint_xml_file }}
3237
- ${{ inputs.level }}
3338
- ${{ inputs.reporter }}
39+
- ${{ inputs.reviewdog_flags }}
3440

3541
branding:
3642
icon: 'smartphone'

converter.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,10 @@
3434
else:
3535
error.attrib['column'] = str(0)
3636

37-
error.attrib['severity'] = 'error'
37+
if 'severity' in issue.attrib:
38+
error.attrib['severity'] = issue.attrib['severity']
39+
else:
40+
error.attrib['severity'] = 'info'
3841

3942
issueId = issue.attrib['id']
4043
message = issue.attrib['message']

entrypoint.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
export REVIEWDOG_GITHUB_API_TOKEN="${INPUT_GITHUB_TOKEN}"
44

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

0 commit comments

Comments
 (0)