Open
Show file tree
Hide file tree
Changes from all commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Failed to load files.
Original file line numberDiff line numberDiff line change
Expand Up@@ -17,6 +17,9 @@ inputs:
standard:
description: 'Code style standard name (PEAR, ) or path to a phpcs.xml file'
required: false
fail_on_errors:
description: 'Whether action should fail on errors or not, default to true (fails)'
required: false
fail_on_warnings:
description: 'Whether action should fail on warnings or not, default to true (fails)'
required: false
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -33,8 +33,8 @@ async function run(): Promise<void> {
await runOnBlame(files.modified);
}
} catch (error) {
core.setFailed(error);
// core.setFailed(error);
}
}

run();
void run();
Original file line numberDiff line numberDiff line change
Expand Up@@ -4,7 +4,7 @@ import { blame } from 'git-blame-json';
import * as path from 'path';
import * as core from '@actions/core';
import * as from '@actions/';
import * as Webhooks from '@octokit/webhooks';
//import * as Webhooks from '@octokit/webhooks';

export async function runOnBlame(files: string[]): Promise<void> {
try {
Expand All@@ -17,6 +17,9 @@ export async function runOnBlame(files: string[]): Promise<void> {
core.getInput('phpcs_path', { required: true })
);

const dontFailOnError =
core.getInput('fail_on_errors') == 'false' ||
core.getInput('fail_on_errors') === 'off';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not really great to use double negatives in variable names, but given that dontFailOnWarning already exists, meh.
Although given that this is later only used as !dontFailOnError I think it's actually better to simply name it failOnError.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree but the original author already had this, I only intended to add a "copy" which works the same as the warning option.

const dontFailOnWarning =
core.getInput('fail_on_warnings') == 'false' ||
core.getInput('fail_on_warnings') === 'off';
Expand All@@ -26,8 +29,6 @@ export async function runOnBlame(files: string[]): Promise<void> {
}

// blame files and output relevant errors
const payload = .context
.payload as Webhooks.WebhookPayloadPullRequest;
// get email of author of first commit in PR
const authorEmail = execFileSync(
'git',
Expand DownExpand Up@@ -56,14 +57,15 @@ export async function runOnBlame(files: string[]): Promise<void> {
message.source
);
// fail
if (message.type === 'WARNING' && !dontFailOnWarning)
/*if (message.type === 'WARNING' && !dontFailOnWarning)
core.setFailed(message.message);
else if (message.type === 'ERROR') core.setFailed(message.message);
else if (message.type === 'ERROR' && !dontFailOnError)
core.setFailed(message.message);*/
}
}
}
} catch (err) {
core.debug(err);
core.setFailed(err);
// core.setFailed(err);
}
}
Original file line numberDiff line numberDiff line change
Expand Up@@ -12,6 +12,10 @@ export function runOnCompleteFiles(files: string[]): number {
const standard = core.getInput('standard');
if (standard) args.push(`--standard=${standard}`);

const failOnError = core.getInput('fail_on_errors');
if (failOnError == 'false' || failOnError === 'off') {
args.push('--runtime-set ignore_errors_on_exit 1');
}
const failOnWarning = core.getInput('fail_on_warnings');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Such consistency by the original author...

if (failOnWarning == 'false' || failOnWarning === 'off') {
args.push('--runtime-set ignore_warnings_on_exit 1');
Expand All@@ -25,7 +29,7 @@ export function runOnCompleteFiles(files: string[]): number {
return 0;
} catch (err) {
core.debug(err);
core.setFailed(err);
// core.setFailed(err);
return 1;
}
}
Binary file not shown.