Skip to content

Commit ae78205

Browse files
authored
fix: treat tflint exit code 2 as failure (#324)
1 parent d12e7d7 commit ae78205

File tree

2 files changed

+12
-14
lines changed

2 files changed

+12
-14
lines changed

dist/index1.js

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3596,13 +3596,12 @@ async function checkTflint() {
35963596
core.setOutput('stderr', stderr.contents);
35973597
core.setOutput('exitcode', exitCode.toString(10));
35983598

3599-
if (exitCode === 0 || exitCode === 2) {
3600-
// A exitCode of 0 is considered a success
3601-
// An exitCode of 2 denotes no errors occurred, but issues found
3602-
return;
3599+
if (exitCode !== 0) {
3600+
// Any non-zero exit code is considered a failure
3601+
// Exit code 1: Errors in tflint execution
3602+
// Exit code 2: Issues found above --minimum-failure-severity threshold
3603+
// Exit code 3+: Other errors
3604+
core.setFailed(`TFLint exited with code ${exitCode}.`);
36033605
}
3604-
3605-
// A non-zero exitCode is considered an error
3606-
core.setFailed(`TFLint exited with code ${exitCode}.`);
36073606
})();
36083607

wrapper/tflint.js

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,11 @@ async function checkTflint() {
4141
core.setOutput('stderr', stderr.contents);
4242
core.setOutput('exitcode', exitCode.toString(10));
4343

44-
if (exitCode === 0 || exitCode === 2) {
45-
// A exitCode of 0 is considered a success
46-
// An exitCode of 2 denotes no errors occurred, but issues found
47-
return;
44+
if (exitCode !== 0) {
45+
// Any non-zero exit code is considered a failure
46+
// Exit code 1: Errors in tflint execution
47+
// Exit code 2: Issues found above --minimum-failure-severity threshold
48+
// Exit code 3+: Other errors
49+
core.setFailed(`TFLint exited with code ${exitCode}.`);
4850
}
49-
50-
// A non-zero exitCode is considered an error
51-
core.setFailed(`TFLint exited with code ${exitCode}.`);
5251
})();

0 commit comments

Comments
 (0)