Merge pull request #2988 from github/koesie10/disable-combine-single-file

Disable combining runs within a single file
This commit is contained in:
Koen Vlaswinkel
2025-07-23 14:17:59 +02:00
committed by GitHub
3 changed files with 6 additions and 7 deletions
+2 -3
View File
@@ -181,9 +181,6 @@ async function shouldDisableCombineSarifFiles(sarifObjects, features, githubVers
// Returns the contents of the combined sarif file.
async function combineSarifFilesUsingCLI(sarifFiles, gitHubVersion, features, logger) {
logger.info("Combining SARIF files using the CodeQL CLI");
if (sarifFiles.length === 1) {
return JSON.parse(fs.readFileSync(sarifFiles[0], "utf8"));
}
const sarifObjects = sarifFiles.map((sarifFile) => {
return JSON.parse(fs.readFileSync(sarifFile, "utf8"));
});
@@ -490,6 +487,8 @@ async function uploadSpecifiedFiles(sarifPaths, checkoutPath, category, features
const sarifPath = sarifPaths[0];
sarif = readSarifFile(sarifPath);
validateSarifFileSchema(sarif, sarifPath, logger);
// Validate that there are no runs for the same category
await throwIfCombineSarifFilesDisabled([sarif], features, gitHubVersion);
}
sarif = filterAlertsByDiffRange(logger, sarif);
sarif = await fingerprints.addFingerprints(sarif, checkoutPath, logger);
File diff suppressed because one or more lines are too long
+3 -3
View File
@@ -206,9 +206,6 @@ async function combineSarifFilesUsingCLI(
logger: Logger,
): Promise<SarifFile> {
logger.info("Combining SARIF files using the CodeQL CLI");
if (sarifFiles.length === 1) {
return JSON.parse(fs.readFileSync(sarifFiles[0], "utf8")) as SarifFile;
}
const sarifObjects = sarifFiles.map((sarifFile): SarifFile => {
return JSON.parse(fs.readFileSync(sarifFile, "utf8")) as SarifFile;
@@ -728,6 +725,9 @@ export async function uploadSpecifiedFiles(
const sarifPath = sarifPaths[0];
sarif = readSarifFile(sarifPath);
validateSarifFileSchema(sarif, sarifPath, logger);
// Validate that there are no runs for the same category
await throwIfCombineSarifFilesDisabled([sarif], features, gitHubVersion);
}
sarif = filterAlertsByDiffRange(logger, sarif);