mirror of
https://github.com/github/codeql-action.git
synced 2026-01-05 14:10:11 +08:00
Merge branch 'main' into daverlo/python-mac
This commit is contained in:
@@ -1,7 +1,11 @@
|
||||
import * as core from "@actions/core";
|
||||
|
||||
import * as actionsUtil from "./actions-util";
|
||||
import { AnalysisStatusReport, runAnalyze } from "./analyze";
|
||||
import {
|
||||
AnalysisStatusReport,
|
||||
runAnalyze,
|
||||
CodeQLAnalysisError,
|
||||
} from "./analyze";
|
||||
import { getConfig } from "./config-utils";
|
||||
import { getActionsLogger } from "./logging";
|
||||
import { parseRepositoryNwo } from "./repository";
|
||||
@@ -84,6 +88,11 @@ async function run() {
|
||||
} catch (error) {
|
||||
core.setFailed(error.message);
|
||||
console.log(error);
|
||||
|
||||
if (error instanceof CodeQLAnalysisError) {
|
||||
stats = { ...error.queriesStatusReport };
|
||||
}
|
||||
|
||||
await sendStatusReport(startedAt, stats, error);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -13,6 +13,17 @@ import * as sharedEnv from "./shared-environment";
|
||||
import * as upload_lib from "./upload-lib";
|
||||
import * as util from "./util";
|
||||
|
||||
export class CodeQLAnalysisError extends Error {
|
||||
queriesStatusReport: QueriesStatusReport;
|
||||
|
||||
constructor(queriesStatusReport: QueriesStatusReport, message: string) {
|
||||
super(message);
|
||||
|
||||
this.name = "CodeQLAnalysisError";
|
||||
this.queriesStatusReport = queriesStatusReport;
|
||||
}
|
||||
}
|
||||
|
||||
export interface QueriesStatusReport {
|
||||
// Time taken in ms to analyze builtin queries for cpp (or undefined if this language was not analyzed)
|
||||
analyze_builtin_queries_cpp_duration_ms?: number;
|
||||
@@ -190,10 +201,12 @@ export async function runQueries(
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
logger.error(`Error running analysis for ${language}: ${e}`);
|
||||
logger.info(e);
|
||||
statusReport.analyze_failure_language = language;
|
||||
return statusReport;
|
||||
throw new CodeQLAnalysisError(
|
||||
statusReport,
|
||||
`Error running analysis for ${language}: ${e}`
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user