mirror of
https://github.com/github/codeql-action
synced 2026-05-23 20:00:54 +03:00
Have a catch all coded error for lint failures
This commit is contained in:
Generated
+10
-4
@@ -178,6 +178,7 @@ exports.WorkflowErrors = toCodedErrors({
|
||||
PathsSpecified: `Using on.push.paths can prevent Code Scanning annotating new alerts in your pull requests.`,
|
||||
PathsIgnoreSpecified: `Using on.push.paths-ignore can prevent Code Scanning annotating new alerts in your pull requests.`,
|
||||
CheckoutWrongHead: `git checkout HEAD^2 is no longer necessary. Please remove this step as Code Scanning recommends analyzing the merge commit for best results.`,
|
||||
LintFailed: `Unable to lint workflow for CodeQL.`,
|
||||
});
|
||||
function validateWorkflow(doc) {
|
||||
var _a, _b, _c, _d, _e, _f, _g;
|
||||
@@ -273,11 +274,16 @@ function validateWorkflow(doc) {
|
||||
}
|
||||
exports.validateWorkflow = validateWorkflow;
|
||||
async function getWorkflowErrors() {
|
||||
const workflow = await getWorkflow();
|
||||
if (workflow === undefined) {
|
||||
return [];
|
||||
try {
|
||||
const workflow = await getWorkflow();
|
||||
if (workflow === undefined) {
|
||||
return [];
|
||||
}
|
||||
return validateWorkflow(workflow);
|
||||
}
|
||||
catch (e) {
|
||||
return [exports.WorkflowErrors.LintFailed];
|
||||
}
|
||||
return validateWorkflow(workflow);
|
||||
}
|
||||
exports.getWorkflowErrors = getWorkflowErrors;
|
||||
function formatWorkflowErrors(errors) {
|
||||
|
||||
File diff suppressed because one or more lines are too long
+10
-5
@@ -232,6 +232,7 @@ export const WorkflowErrors = toCodedErrors({
|
||||
PathsSpecified: `Using on.push.paths can prevent Code Scanning annotating new alerts in your pull requests.`,
|
||||
PathsIgnoreSpecified: `Using on.push.paths-ignore can prevent Code Scanning annotating new alerts in your pull requests.`,
|
||||
CheckoutWrongHead: `git checkout HEAD^2 is no longer necessary. Please remove this step as Code Scanning recommends analyzing the merge commit for best results.`,
|
||||
LintFailed: `Unable to lint workflow for CodeQL.`,
|
||||
});
|
||||
|
||||
export function validateWorkflow(doc: Workflow): CodedError[] {
|
||||
@@ -332,13 +333,17 @@ export function validateWorkflow(doc: Workflow): CodedError[] {
|
||||
}
|
||||
|
||||
export async function getWorkflowErrors(): Promise<CodedError[]> {
|
||||
const workflow = await getWorkflow();
|
||||
try {
|
||||
const workflow = await getWorkflow();
|
||||
|
||||
if (workflow === undefined) {
|
||||
return [];
|
||||
if (workflow === undefined) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return validateWorkflow(workflow);
|
||||
} catch (e) {
|
||||
return [WorkflowErrors.LintFailed];
|
||||
}
|
||||
|
||||
return validateWorkflow(workflow);
|
||||
}
|
||||
|
||||
export function formatWorkflowErrors(errors: CodedError[]): string {
|
||||
|
||||
Reference in New Issue
Block a user