Skip to content

Commit 6b7d4fe

Browse files
committed
add ignore_warnings_on_exit and ignore_errors_on_exit options to avoid a non-zero error code in the presence of warnings or errors respectively
1 parent c82f85c commit 6b7d4fe

File tree

3 files changed

+20
-0
lines changed

3 files changed

+20
-0
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ The following configuration options are available:
6969
+ `severity` - The minimum severity required to display an error or warning
7070
+ `error_severity` - The minimum severity required to display an error
7171
+ `warning_severity` - The minimum severity required to display a warning
72+
+ `ignore_warnings_on_exit` - Exit with a zero error code despite the presence of warnings (1 = true, default 0 = false).
73+
+ `ignore_errors_on_exit` - xit with a zero error code despite the presence of errors (1 = true, default 0 = false).
7274
+ `args` - Extra arguments to pass to the phpcs binary
7375

7476
If you require other configurations of PHPMD, please request them in the [Github issue tracker].

action.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,14 @@ inputs:
8181
description: The minimum severity required to display a warning
8282
required: false
8383

84+
ignore_warnings_on_exit:
85+
desctiption: Exit with a zero error code despite the presence of warnings (1 = true, default 0 = false).
86+
required: false
87+
88+
ignore_errors_on_exit:
89+
description: Exit with a zero error code despite the presence of errors (1 = true, default 0 = false).
90+
required: false
91+
8492
args:
8593
description: Extra arguments to pass to the phpcs binary
8694
required: false

phpcs-action.bash

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,16 @@ then
9595
command_string+=(--warning-severity="$ACTION_WARNING_SEVERITY")
9696
fi
9797

98+
if [ -n "$ACTION_IGNORE_WARNINGS_ON_EXIT" ]
99+
then
100+
command_string+=(--runtime-set ignore_warnings_on_exit "$ACTION_IGNORE_WARNINGS_ON_EXIT")
101+
fi
102+
103+
if [ -n "$ACTION_IGNORE_ERRORS_ON_EXIT" ]
104+
then
105+
command_string+=(--runtime-set ignore_errors_on_exit "$ACTION_IGNORE_ERRORS_ON_EXIT")
106+
fi
107+
98108
if [ -n "$ACTION_ARGS" ]
99109
then
100110
command_string+=($ACTION_ARGS)

0 commit comments

Comments
 (0)