mirror of
https://github.com/github/codeql-action.git
synced 2026-05-04 12:50:14 +00:00
Remove CodeQL init code from uploadSpecifiedFiles since it shouldn't be needed anymore
This commit is contained in:
Generated
+3
-13
@@ -61,8 +61,6 @@ const jsonschema = __importStar(require("jsonschema"));
|
||||
const actionsUtil = __importStar(require("./actions-util"));
|
||||
const api = __importStar(require("./api-client"));
|
||||
const api_client_1 = require("./api-client");
|
||||
const codeql_1 = require("./codeql");
|
||||
const config_utils_1 = require("./config-utils");
|
||||
const diff_informed_analysis_utils_1 = require("./diff-informed-analysis-utils");
|
||||
const environment_1 = require("./environment");
|
||||
const fingerprints = __importStar(require("./fingerprints"));
|
||||
@@ -460,7 +458,7 @@ async function uploadFiles(codeQL, inputSarifPath, checkoutPath, category, featu
|
||||
/**
|
||||
* Uploads the given array of SARIF files.
|
||||
*/
|
||||
async function uploadSpecifiedFiles(codeQL, sarifPaths, checkoutPath, category, features, logger, uploadTarget = exports.CodeScanningTarget) {
|
||||
async function uploadSpecifiedFiles(codeQL, sarifPaths, checkoutPath, category, _features, logger, uploadTarget = exports.CodeScanningTarget) {
|
||||
logger.startGroup(`Uploading ${uploadTarget.name} results`);
|
||||
logger.info(`Processing sarif files: ${JSON.stringify(sarifPaths)}`);
|
||||
const gitHubVersion = await (0, api_client_1.getGitHubVersion)();
|
||||
@@ -471,17 +469,9 @@ async function uploadSpecifiedFiles(codeQL, sarifPaths, checkoutPath, category,
|
||||
const parsedSarif = readSarifFile(sarifPath);
|
||||
validateSarifFileSchema(parsedSarif, sarifPath, logger);
|
||||
}
|
||||
// Initialize CodeQL, either by using the config file from the 'init' step,
|
||||
// or by initializing it here if we don't already have an instance.
|
||||
// CodeQL should always be initialised at this point if we have multiple sarif files.
|
||||
if (codeQL === undefined) {
|
||||
const tempDir = actionsUtil.getTemporaryDirectory();
|
||||
const config = await (0, config_utils_1.getConfig)(tempDir, logger);
|
||||
if (config !== undefined) {
|
||||
codeQL = await (0, codeql_1.getCodeQL)(config.codeQLCmd);
|
||||
}
|
||||
else {
|
||||
codeQL = await initCodeQLForUpload(gitHubVersion, features, logger);
|
||||
}
|
||||
throw new Error(`Unexpectedly, CodeQL has not been initialised for the upload of multiple files.`);
|
||||
}
|
||||
sarif = await combineSarifFilesUsingCLI(codeQL, sarifPaths, gitHubVersion, logger);
|
||||
}
|
||||
|
||||
File diff suppressed because one or more lines are too long
+6
-13
@@ -10,8 +10,7 @@ import * as jsonschema from "jsonschema";
|
||||
import * as actionsUtil from "./actions-util";
|
||||
import * as api from "./api-client";
|
||||
import { getGitHubVersion, wrapApiConfigurationError } from "./api-client";
|
||||
import { CodeQL, getCodeQL } from "./codeql";
|
||||
import { getConfig } from "./config-utils";
|
||||
import { CodeQL } from "./codeql";
|
||||
import { readDiffRangesJsonFile } from "./diff-informed-analysis-utils";
|
||||
import { EnvVar } from "./environment";
|
||||
import { FeatureEnablement } from "./feature-flags";
|
||||
@@ -677,7 +676,7 @@ export async function uploadSpecifiedFiles(
|
||||
sarifPaths: string[],
|
||||
checkoutPath: string,
|
||||
category: string | undefined,
|
||||
features: FeatureEnablement,
|
||||
_features: FeatureEnablement,
|
||||
logger: Logger,
|
||||
uploadTarget: UploadTarget = CodeScanningTarget,
|
||||
): Promise<UploadResult> {
|
||||
@@ -695,17 +694,11 @@ export async function uploadSpecifiedFiles(
|
||||
validateSarifFileSchema(parsedSarif, sarifPath, logger);
|
||||
}
|
||||
|
||||
// Initialize CodeQL, either by using the config file from the 'init' step,
|
||||
// or by initializing it here if we don't already have an instance.
|
||||
// CodeQL should always be initialised at this point if we have multiple sarif files.
|
||||
if (codeQL === undefined) {
|
||||
const tempDir: string = actionsUtil.getTemporaryDirectory();
|
||||
|
||||
const config = await getConfig(tempDir, logger);
|
||||
if (config !== undefined) {
|
||||
codeQL = await getCodeQL(config.codeQLCmd);
|
||||
} else {
|
||||
codeQL = await initCodeQLForUpload(gitHubVersion, features, logger);
|
||||
}
|
||||
throw new Error(
|
||||
`Unexpectedly, CodeQL has not been initialised for the upload of multiple files.`,
|
||||
);
|
||||
}
|
||||
|
||||
sarif = await combineSarifFilesUsingCLI(
|
||||
|
||||
Reference in New Issue
Block a user