Skip to content

Commit 69a9fa7

Browse files
committed
Accept option to pass on codestyle errors.
1 parent 0317fe1 commit 69a9fa7

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

action.yml

+3
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ inputs:
1717
standard:
1818
description: 'Code style standard name (PEAR, ) or path to a phpcs.xml file'
1919
required: false
20+
fail_on_errors:
21+
description: 'Whether action should fail on errors or not, default to true (fails)'
22+
required: false
2023
fail_on_warnings:
2124
description: 'Whether action should fail on warnings or not, default to true (fails)'
2225
required: false

src/run-on-blame.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ export async function runOnBlame(files: string[]): Promise<void> {
1818
options
1919
);
2020

21+
const dontFailOnError =
22+
core.getInput('fail_on_errors') == 'false' ||
23+
core.getInput('fail_on_errors') === 'off';
2124
const dontFailOnWarning =
2225
core.getInput('fail_on_warnings') == 'false' ||
2326
core.getInput('fail_on_warnings') === 'off';
@@ -59,7 +62,8 @@ export async function runOnBlame(files: string[]): Promise<void> {
5962
// fail
6063
if (message.type === 'WARNING' && !dontFailOnWarning)
6164
core.setFailed(message.message);
62-
else if (message.type === 'ERROR') core.setFailed(message.message);
65+
else if (message.type === 'ERROR' && !dontFailOnError)
66+
core.setFailed(message.message);
6367
}
6468
}
6569
}

src/run-on-files.ts

+4
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ export function runOnCompleteFiles(files: string[]): number {
1212
const standard = core.getInput('standard');
1313
if (standard) args.push(`--standard=${standard}`);
1414

15+
const failOnError = core.getInput('fail_on_errors');
16+
if (failOnError == 'false' || failOnError === 'off') {
17+
args.push('--runtime-set ignore_errors_on_exit 1');
18+
}
1519
const failOnWarning = core.getInput('fail_on_warnings');
1620
if (failOnWarning == 'false' || failOnWarning === 'off') {
1721
args.push('--runtime-set ignore_warnings_on_exit 1');

0 commit comments

Comments
 (0)