Skip to content

Commit 1f78683

Browse files
Merge pull request #866 from yutailang0119/cleanup-ignore-warnings
Cleanup ignore warnings
2 parents 6d0067a + a59e40b commit 1f78683

File tree

6 files changed

+23
-13
lines changed

6 files changed

+23
-13
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ jobs:
3737
- run: ./gradlew lint
3838
- uses: yutailang0119/action-android-lint@v3
3939
with:
40-
ignore-warnings: true # Ignore Lint Warnings
4140
report-path: build/reports/*.xml # Support glob patterns by https://www.npmjs.com/package/@actions/glob
41+
ignore-warnings: true # Ignore Lint Warnings
4242
continue-on-error: false # If annotations contain error of severity, action-android-lint exit 1.
4343
```
4444

action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ inputs:
1010
default: true
1111
ignore-warnings:
1212
description: 'Ignore Lint Warnings'
13-
default: false
13+
default: false
1414
runs:
1515
using: 'node20'
1616
main: 'dist/index.js'

dist/index.js

Lines changed: 9 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/main.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,11 @@ import {parseXmls} from './parser'
66
async function run(): Promise<void> {
77
try {
88
const reportPath = core.getInput('report-path', {required: true})
9-
const ignoreWarnings = core.getBooleanInput('ignore-warnings')
109
const globOptions = {
1110
followSymbolicLinks: core.getBooleanInput('follow-symbolic-links')
1211
}
12+
const ignoreWarnings = core.getBooleanInput('ignore-warnings')
13+
1314
const globber = await glob.create(reportPath, globOptions)
1415
const files = await globber.glob()
1516

src/parser.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,6 @@ export const parseXml = async (
2828
const annotations: Annotation[] = []
2929
for (const issueElement of xml.issues.issue) {
3030
const issue = issueElement.$
31-
if (ignoreWarnings === true && issue.severity !== 'Error') {
32-
continue
33-
}
3431
for (const locationElement of issueElement.location) {
3532
const location = locationElement.$
3633

@@ -44,7 +41,15 @@ export const parseXml = async (
4441
annotations.push(annotation)
4542
}
4643
}
47-
resolve(annotations)
44+
if (ignoreWarnings === true) {
45+
resolve(
46+
annotations.filter(annotation => {
47+
return annotation.severityLevel !== 'warning'
48+
})
49+
)
50+
} else {
51+
resolve(annotations)
52+
}
4853
} catch (error) {
4954
core.debug(`failed to read ${error}`)
5055
}

0 commit comments

Comments
 (0)