From ab179af8fba56b0428b0537bca816fa5aa29ebd6 Mon Sep 17 00:00:00 2001 From: Anton Konovalov Date: Wed, 9 Feb 2022 18:45:30 +0200 Subject: [PATCH] Fail on errors when reportWarningsAsErrors used --- lib/eslint.js | 7 ++++++- package.json | 2 +- src/eslint.ts | 7 ++++++- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/lib/eslint.js b/lib/eslint.js index 336f29b..48c9386 100644 --- a/lib/eslint.js +++ b/lib/eslint.js @@ -59,7 +59,12 @@ function lintChangedFiles(client, data) { } finally { if (e_1) throw e_1.error; } } - data.state.conclusion = data.state.errorCount > 0 ? 'failure' : 'success'; + data.state.conclusion = + data.state.errorCount > 0 || + !data.reportWarningsAsErrors || + data.state.warningCount > 0 + ? 'failure' + : 'success'; yield updateCheck({ conclusion: data.state.conclusion, status: 'completed', diff --git a/package.json b/package.json index ce492e7..8df9105 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "typescript-action", - "version": "3.4.2", + "version": "3.4.3", "private": true, "description": "TypeScript template action", "main": "lib/run.js", diff --git a/src/eslint.ts b/src/eslint.ts index f4493ad..1c0a286 100644 --- a/src/eslint.ts +++ b/src/eslint.ts @@ -71,7 +71,12 @@ export async function lintChangedFiles( } } - data.state.conclusion = data.state.errorCount > 0 ? 'failure' : 'success'; + data.state.conclusion = + data.state.errorCount > 0 || + !data.reportWarningsAsErrors || + data.state.warningCount > 0 + ? 'failure' + : 'success'; await updateCheck({ conclusion: data.state.conclusion,