mirror of
https://github.com/github/codeql-action.git
synced 2026-05-08 06:40:19 +00:00
Avoid using a global for getOrInitCodeQL
This commit is contained in:
Generated
+7
-7
@@ -111370,19 +111370,18 @@ function filterAlertsByDiffRange(logger, sarif) {
|
||||
}
|
||||
|
||||
// src/upload-sarif.ts
|
||||
var cachedCodeQL2;
|
||||
async function getOrInitCodeQL(logger, gitHubVersion, features, config) {
|
||||
if (cachedCodeQL2 !== void 0) return cachedCodeQL2;
|
||||
async function getOrInitCodeQL(actionState, logger, gitHubVersion, features, config) {
|
||||
if (actionState.cachedCodeQL !== void 0) return actionState.cachedCodeQL;
|
||||
if (config !== void 0) {
|
||||
cachedCodeQL2 = await getCodeQL(config.codeQLCmd);
|
||||
actionState.cachedCodeQL = await getCodeQL(config.codeQLCmd);
|
||||
} else {
|
||||
cachedCodeQL2 = await minimalInitCodeQL(
|
||||
actionState.cachedCodeQL = await minimalInitCodeQL(
|
||||
logger,
|
||||
gitHubVersion,
|
||||
features
|
||||
);
|
||||
}
|
||||
return cachedCodeQL2;
|
||||
return actionState.cachedCodeQL;
|
||||
}
|
||||
async function postProcessAndUploadSarif(logger, tempPath, features, getCodeQL2, uploadKind, checkoutPath, sarifPath, category, postProcessedOutputPath) {
|
||||
const sarifGroups = await getGroupedSarifFilePaths(
|
||||
@@ -111442,6 +111441,7 @@ async function sendSuccessStatusReport(startedAt, uploadStats, logger) {
|
||||
}
|
||||
async function run(startedAt) {
|
||||
const logger = getActionsLogger();
|
||||
const state = { cachedCodeQL: void 0 };
|
||||
try {
|
||||
initializeEnvironment(getActionVersion());
|
||||
const gitHubVersion = await getGitHubVersion();
|
||||
@@ -111477,7 +111477,7 @@ async function run(startedAt) {
|
||||
logger,
|
||||
tempDir,
|
||||
features,
|
||||
() => getOrInitCodeQL(logger, gitHubVersion, features, config),
|
||||
() => getOrInitCodeQL(state, logger, gitHubVersion, features, config),
|
||||
"always",
|
||||
checkoutPath,
|
||||
sarifPath,
|
||||
|
||||
Reference in New Issue
Block a user