Skip to content

Commit 7bf0b0f

Browse files
committed
Accept option to pass on codestyle errors.
1 parent 01964d2 commit 7bf0b0f

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

Diff for: 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

Diff for: src/run-on-blame.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ export async function runOnBlame(files: string[]): Promise<void> {
1717
core.getInput('phpcs_path', { required: true })
1818
);
1919

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

Diff for: 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)