Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions lib/analyze-action.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/analyze-action.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 9 additions & 2 deletions lib/analyze.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/analyze.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 10 additions & 1 deletion src/analyze-action.ts
Original file line number Diff line number Diff line change
@@ -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";
Expand Down Expand Up @@ -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;
}
Expand Down
17 changes: 15 additions & 2 deletions src/analyze.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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}`
);
}
}

Expand Down