mirror of
https://github.com/github/codeql-action.git
synced 2026-04-27 09:18:47 +00:00
Call getAnalysisKinds a second time, and ignore exceptions thrown during the first call
This commit is contained in:
Generated
+13
-5
@@ -86063,10 +86063,10 @@ function isAnalyzingPullRequest() {
|
||||
}
|
||||
|
||||
// src/analyses.ts
|
||||
var AnalysisKind = /* @__PURE__ */ ((AnalysisKind2) => {
|
||||
AnalysisKind2["CodeScanning"] = "code-scanning";
|
||||
AnalysisKind2["CodeQuality"] = "code-quality";
|
||||
return AnalysisKind2;
|
||||
var AnalysisKind = /* @__PURE__ */ ((AnalysisKind3) => {
|
||||
AnalysisKind3["CodeScanning"] = "code-scanning";
|
||||
AnalysisKind3["CodeQuality"] = "code-quality";
|
||||
return AnalysisKind3;
|
||||
})(AnalysisKind || {});
|
||||
var supportedAnalysisKinds = new Set(Object.values(AnalysisKind));
|
||||
async function parseAnalysisKinds(input) {
|
||||
@@ -90800,7 +90800,14 @@ async function run() {
|
||||
getOptionalInput("source-root") || ""
|
||||
);
|
||||
try {
|
||||
const analysisKinds = await getAnalysisKinds(logger);
|
||||
let analysisKinds;
|
||||
try {
|
||||
analysisKinds = await getAnalysisKinds(logger);
|
||||
} catch (err) {
|
||||
logger.debug(
|
||||
`Failed to parse analysis kinds for 'starting' status report: ${getErrorMessage(err)}`
|
||||
);
|
||||
}
|
||||
await sendStartingStatusReport(startedAt, { analysisKinds }, logger);
|
||||
const codeQLDefaultVersionInfo = await features.getDefaultCliVersion(
|
||||
gitHubVersion.type
|
||||
@@ -90848,6 +90855,7 @@ async function run() {
|
||||
logger.info("Experimental Rust analysis enabled");
|
||||
}
|
||||
}
|
||||
analysisKinds = await getAnalysisKinds(logger);
|
||||
config = await initConfig2({
|
||||
analysisKinds,
|
||||
languagesInput: getOptionalInput("languages"),
|
||||
|
||||
+16
-3
@@ -15,7 +15,7 @@ import {
|
||||
getTemporaryDirectory,
|
||||
persistInputs,
|
||||
} from "./actions-util";
|
||||
import { getAnalysisKinds } from "./analyses";
|
||||
import { AnalysisKind, getAnalysisKinds } from "./analyses";
|
||||
import { getGitHubVersion } from "./api-client";
|
||||
import {
|
||||
getDependencyCachingEnabled,
|
||||
@@ -253,8 +253,20 @@ async function run() {
|
||||
);
|
||||
|
||||
try {
|
||||
// This may throw a `ConfigurationError` before we have sent the `starting` status report.
|
||||
const analysisKinds = await getAnalysisKinds(logger);
|
||||
// Parsing the `analysis-kinds` input may throw a `ConfigurationError`, which we don't want before
|
||||
// we have called `sendStartingStatusReport` below. However, we want the analysis kinds for that status
|
||||
// report. To work around this, we ignore exceptions that are thrown here and then call `getAnalysisKinds`
|
||||
// a second time later. The second call will then throw the exception again. If `getAnalysisKinds` is
|
||||
// successful, the results are cached so that we don't duplicate the work in normal runs.
|
||||
let analysisKinds: AnalysisKind[] | undefined;
|
||||
try {
|
||||
analysisKinds = await getAnalysisKinds(logger);
|
||||
} catch (err) {
|
||||
logger.debug(
|
||||
`Failed to parse analysis kinds for 'starting' status report: ${getErrorMessage(err)}`,
|
||||
);
|
||||
}
|
||||
|
||||
// Send a status report indicating that an analysis is starting.
|
||||
await sendStartingStatusReport(startedAt, { analysisKinds }, logger);
|
||||
const codeQLDefaultVersionInfo = await features.getDefaultCliVersion(
|
||||
@@ -312,6 +324,7 @@ async function run() {
|
||||
}
|
||||
}
|
||||
|
||||
analysisKinds = await getAnalysisKinds(logger);
|
||||
config = await initConfig({
|
||||
analysisKinds,
|
||||
languagesInput: getOptionalInput("languages"),
|
||||
|
||||
Reference in New Issue
Block a user