mirror of
https://github.com/github/codeql-action.git
synced 2026-05-07 06:10:19 +00:00
Refactor minimalInitCodeQL out of combineSarifFilesUsingCLI
This commit is contained in:
Generated
+26
-25
@@ -112327,6 +112327,31 @@ async function shouldDisableCombineSarifFiles(sarifObjects, githubVersion) {
|
||||
}
|
||||
return true;
|
||||
}
|
||||
async function minimalInitCodeQL(logger, gitHubVersion, features) {
|
||||
logger.info(
|
||||
"Initializing CodeQL since the 'init' Action was not called before this step."
|
||||
);
|
||||
const apiDetails = {
|
||||
auth: getRequiredInput("token"),
|
||||
externalRepoAuth: getOptionalInput("external-repository-token"),
|
||||
url: getRequiredEnvParam("GITHUB_SERVER_URL"),
|
||||
apiURL: getRequiredEnvParam("GITHUB_API_URL")
|
||||
};
|
||||
const codeQLDefaultVersionInfo = await features.getDefaultCliVersion(
|
||||
gitHubVersion.type
|
||||
);
|
||||
const initCodeQLResult = await initCodeQL(
|
||||
void 0,
|
||||
// There is no tools input on the upload action
|
||||
apiDetails,
|
||||
getTemporaryDirectory(),
|
||||
gitHubVersion.type,
|
||||
codeQLDefaultVersionInfo,
|
||||
features,
|
||||
logger
|
||||
);
|
||||
return initCodeQLResult.codeql;
|
||||
}
|
||||
async function combineSarifFilesUsingCLI(sarifFiles, gitHubVersion, features, logger) {
|
||||
logger.info("Combining SARIF files using the CodeQL CLI");
|
||||
const sarifObjects = sarifFiles.map((sarifFile) => {
|
||||
@@ -112357,31 +112382,7 @@ async function combineSarifFilesUsingCLI(sarifFiles, gitHubVersion, features, lo
|
||||
codeQL = await getCodeQL(config.codeQLCmd);
|
||||
tempDir = config.tempDir;
|
||||
} else {
|
||||
logger.info(
|
||||
"Initializing CodeQL since the 'init' Action was not called before this step."
|
||||
);
|
||||
const apiDetails = {
|
||||
auth: getRequiredInput("token"),
|
||||
externalRepoAuth: getOptionalInput(
|
||||
"external-repository-token"
|
||||
),
|
||||
url: getRequiredEnvParam("GITHUB_SERVER_URL"),
|
||||
apiURL: getRequiredEnvParam("GITHUB_API_URL")
|
||||
};
|
||||
const codeQLDefaultVersionInfo = await features.getDefaultCliVersion(
|
||||
gitHubVersion.type
|
||||
);
|
||||
const initCodeQLResult = await initCodeQL(
|
||||
void 0,
|
||||
// There is no tools input on the upload action
|
||||
apiDetails,
|
||||
tempDir,
|
||||
gitHubVersion.type,
|
||||
codeQLDefaultVersionInfo,
|
||||
features,
|
||||
logger
|
||||
);
|
||||
codeQL = initCodeQLResult.codeql;
|
||||
codeQL = await minimalInitCodeQL(logger, gitHubVersion, features);
|
||||
}
|
||||
const baseTempDir = path14.resolve(tempDir, "combined-sarif");
|
||||
fs15.mkdirSync(baseTempDir, { recursive: true });
|
||||
|
||||
Generated
+26
-25
@@ -168995,6 +168995,31 @@ async function shouldDisableCombineSarifFiles(sarifObjects, githubVersion) {
|
||||
}
|
||||
return true;
|
||||
}
|
||||
async function minimalInitCodeQL(logger, gitHubVersion, features) {
|
||||
logger.info(
|
||||
"Initializing CodeQL since the 'init' Action was not called before this step."
|
||||
);
|
||||
const apiDetails = {
|
||||
auth: getRequiredInput("token"),
|
||||
externalRepoAuth: getOptionalInput("external-repository-token"),
|
||||
url: getRequiredEnvParam("GITHUB_SERVER_URL"),
|
||||
apiURL: getRequiredEnvParam("GITHUB_API_URL")
|
||||
};
|
||||
const codeQLDefaultVersionInfo = await features.getDefaultCliVersion(
|
||||
gitHubVersion.type
|
||||
);
|
||||
const initCodeQLResult = await initCodeQL(
|
||||
void 0,
|
||||
// There is no tools input on the upload action
|
||||
apiDetails,
|
||||
getTemporaryDirectory(),
|
||||
gitHubVersion.type,
|
||||
codeQLDefaultVersionInfo,
|
||||
features,
|
||||
logger
|
||||
);
|
||||
return initCodeQLResult.codeql;
|
||||
}
|
||||
async function combineSarifFilesUsingCLI(sarifFiles, gitHubVersion, features, logger) {
|
||||
logger.info("Combining SARIF files using the CodeQL CLI");
|
||||
const sarifObjects = sarifFiles.map((sarifFile) => {
|
||||
@@ -169025,31 +169050,7 @@ async function combineSarifFilesUsingCLI(sarifFiles, gitHubVersion, features, lo
|
||||
codeQL = await getCodeQL(config.codeQLCmd);
|
||||
tempDir = config.tempDir;
|
||||
} else {
|
||||
logger.info(
|
||||
"Initializing CodeQL since the 'init' Action was not called before this step."
|
||||
);
|
||||
const apiDetails = {
|
||||
auth: getRequiredInput("token"),
|
||||
externalRepoAuth: getOptionalInput(
|
||||
"external-repository-token"
|
||||
),
|
||||
url: getRequiredEnvParam("GITHUB_SERVER_URL"),
|
||||
apiURL: getRequiredEnvParam("GITHUB_API_URL")
|
||||
};
|
||||
const codeQLDefaultVersionInfo = await features.getDefaultCliVersion(
|
||||
gitHubVersion.type
|
||||
);
|
||||
const initCodeQLResult = await initCodeQL(
|
||||
void 0,
|
||||
// There is no tools input on the upload action
|
||||
apiDetails,
|
||||
tempDir,
|
||||
gitHubVersion.type,
|
||||
codeQLDefaultVersionInfo,
|
||||
features,
|
||||
logger
|
||||
);
|
||||
codeQL = initCodeQLResult.codeql;
|
||||
codeQL = await minimalInitCodeQL(logger, gitHubVersion, features);
|
||||
}
|
||||
const baseTempDir = path15.resolve(tempDir, "combined-sarif");
|
||||
fs15.mkdirSync(baseTempDir, { recursive: true });
|
||||
|
||||
Generated
+28
-25
@@ -103114,6 +103114,7 @@ __export(upload_lib_exports, {
|
||||
buildPayload: () => buildPayload,
|
||||
findSarifFilesInDir: () => findSarifFilesInDir,
|
||||
getGroupedSarifFilePaths: () => getGroupedSarifFilePaths,
|
||||
minimalInitCodeQL: () => minimalInitCodeQL,
|
||||
populateRunAutomationDetails: () => populateRunAutomationDetails,
|
||||
postProcessSarifFiles: () => postProcessSarifFiles,
|
||||
readSarifFile: () => readSarifFile,
|
||||
@@ -110218,6 +110219,31 @@ async function shouldDisableCombineSarifFiles(sarifObjects, githubVersion) {
|
||||
}
|
||||
return true;
|
||||
}
|
||||
async function minimalInitCodeQL(logger, gitHubVersion, features) {
|
||||
logger.info(
|
||||
"Initializing CodeQL since the 'init' Action was not called before this step."
|
||||
);
|
||||
const apiDetails = {
|
||||
auth: getRequiredInput("token"),
|
||||
externalRepoAuth: getOptionalInput("external-repository-token"),
|
||||
url: getRequiredEnvParam("GITHUB_SERVER_URL"),
|
||||
apiURL: getRequiredEnvParam("GITHUB_API_URL")
|
||||
};
|
||||
const codeQLDefaultVersionInfo = await features.getDefaultCliVersion(
|
||||
gitHubVersion.type
|
||||
);
|
||||
const initCodeQLResult = await initCodeQL(
|
||||
void 0,
|
||||
// There is no tools input on the upload action
|
||||
apiDetails,
|
||||
getTemporaryDirectory(),
|
||||
gitHubVersion.type,
|
||||
codeQLDefaultVersionInfo,
|
||||
features,
|
||||
logger
|
||||
);
|
||||
return initCodeQLResult.codeql;
|
||||
}
|
||||
async function combineSarifFilesUsingCLI(sarifFiles, gitHubVersion, features, logger) {
|
||||
logger.info("Combining SARIF files using the CodeQL CLI");
|
||||
const sarifObjects = sarifFiles.map((sarifFile) => {
|
||||
@@ -110248,31 +110274,7 @@ async function combineSarifFilesUsingCLI(sarifFiles, gitHubVersion, features, lo
|
||||
codeQL = await getCodeQL(config.codeQLCmd);
|
||||
tempDir = config.tempDir;
|
||||
} else {
|
||||
logger.info(
|
||||
"Initializing CodeQL since the 'init' Action was not called before this step."
|
||||
);
|
||||
const apiDetails = {
|
||||
auth: getRequiredInput("token"),
|
||||
externalRepoAuth: getOptionalInput(
|
||||
"external-repository-token"
|
||||
),
|
||||
url: getRequiredEnvParam("GITHUB_SERVER_URL"),
|
||||
apiURL: getRequiredEnvParam("GITHUB_API_URL")
|
||||
};
|
||||
const codeQLDefaultVersionInfo = await features.getDefaultCliVersion(
|
||||
gitHubVersion.type
|
||||
);
|
||||
const initCodeQLResult = await initCodeQL(
|
||||
void 0,
|
||||
// There is no tools input on the upload action
|
||||
apiDetails,
|
||||
tempDir,
|
||||
gitHubVersion.type,
|
||||
codeQLDefaultVersionInfo,
|
||||
features,
|
||||
logger
|
||||
);
|
||||
codeQL = initCodeQLResult.codeql;
|
||||
codeQL = await minimalInitCodeQL(logger, gitHubVersion, features);
|
||||
}
|
||||
const baseTempDir = path11.resolve(tempDir, "combined-sarif");
|
||||
fs11.mkdirSync(baseTempDir, { recursive: true });
|
||||
@@ -110821,6 +110823,7 @@ function filterAlertsByDiffRange(logger, sarif) {
|
||||
buildPayload,
|
||||
findSarifFilesInDir,
|
||||
getGroupedSarifFilePaths,
|
||||
minimalInitCodeQL,
|
||||
populateRunAutomationDetails,
|
||||
postProcessSarifFiles,
|
||||
readSarifFile,
|
||||
|
||||
Generated
+26
-25
@@ -110809,6 +110809,31 @@ async function shouldDisableCombineSarifFiles(sarifObjects, githubVersion) {
|
||||
}
|
||||
return true;
|
||||
}
|
||||
async function minimalInitCodeQL(logger, gitHubVersion, features) {
|
||||
logger.info(
|
||||
"Initializing CodeQL since the 'init' Action was not called before this step."
|
||||
);
|
||||
const apiDetails = {
|
||||
auth: getRequiredInput("token"),
|
||||
externalRepoAuth: getOptionalInput("external-repository-token"),
|
||||
url: getRequiredEnvParam("GITHUB_SERVER_URL"),
|
||||
apiURL: getRequiredEnvParam("GITHUB_API_URL")
|
||||
};
|
||||
const codeQLDefaultVersionInfo = await features.getDefaultCliVersion(
|
||||
gitHubVersion.type
|
||||
);
|
||||
const initCodeQLResult = await initCodeQL(
|
||||
void 0,
|
||||
// There is no tools input on the upload action
|
||||
apiDetails,
|
||||
getTemporaryDirectory(),
|
||||
gitHubVersion.type,
|
||||
codeQLDefaultVersionInfo,
|
||||
features,
|
||||
logger
|
||||
);
|
||||
return initCodeQLResult.codeql;
|
||||
}
|
||||
async function combineSarifFilesUsingCLI(sarifFiles, gitHubVersion, features, logger) {
|
||||
logger.info("Combining SARIF files using the CodeQL CLI");
|
||||
const sarifObjects = sarifFiles.map((sarifFile) => {
|
||||
@@ -110839,31 +110864,7 @@ async function combineSarifFilesUsingCLI(sarifFiles, gitHubVersion, features, lo
|
||||
codeQL = await getCodeQL(config.codeQLCmd);
|
||||
tempDir = config.tempDir;
|
||||
} else {
|
||||
logger.info(
|
||||
"Initializing CodeQL since the 'init' Action was not called before this step."
|
||||
);
|
||||
const apiDetails = {
|
||||
auth: getRequiredInput("token"),
|
||||
externalRepoAuth: getOptionalInput(
|
||||
"external-repository-token"
|
||||
),
|
||||
url: getRequiredEnvParam("GITHUB_SERVER_URL"),
|
||||
apiURL: getRequiredEnvParam("GITHUB_API_URL")
|
||||
};
|
||||
const codeQLDefaultVersionInfo = await features.getDefaultCliVersion(
|
||||
gitHubVersion.type
|
||||
);
|
||||
const initCodeQLResult = await initCodeQL(
|
||||
void 0,
|
||||
// There is no tools input on the upload action
|
||||
apiDetails,
|
||||
tempDir,
|
||||
gitHubVersion.type,
|
||||
codeQLDefaultVersionInfo,
|
||||
features,
|
||||
logger
|
||||
);
|
||||
codeQL = initCodeQLResult.codeql;
|
||||
codeQL = await minimalInitCodeQL(logger, gitHubVersion, features);
|
||||
}
|
||||
const baseTempDir = path12.resolve(tempDir, "combined-sarif");
|
||||
fs12.mkdirSync(baseTempDir, { recursive: true });
|
||||
|
||||
Reference in New Issue
Block a user