Merge pull request #3424 from github/henrymercer/feature-skip-file-coverage-info-prs

Add feature flag to skip computing baseline file coverage information on PRs
This commit is contained in:
Henry Mercer
2026-01-27 06:49:29 -08:00
committed by GitHub
25 changed files with 370 additions and 143 deletions
+18 -12
View File
@@ -86957,6 +86957,15 @@ var featureConfig = {
legacyApi: true,
minimumVersion: void 0
},
["skip_file_coverage_on_prs" /* SkipFileCoverageOnPrs */]: {
defaultValue: false,
envVar: "CODEQL_ACTION_SKIP_FILE_COVERAGE_ON_PRS",
// For testing, this is not behind a CLI version check yet. However
// before rolling this out externally, we should set a minimum version here
// since current versions of the CodeQL CLI will log if baseline information
// cannot be found when interpreting results.
minimumVersion: void 0
},
["upload_overlay_db_to_api" /* UploadOverlayDbToApi */]: {
defaultValue: false,
envVar: "CODEQL_ACTION_UPLOAD_OVERLAY_DB_TO_API",
@@ -88584,6 +88593,10 @@ async function getCodeQLForCmd(cmd, checkVersion) {
} else if (overlayDatabaseMode === "overlay-base" /* OverlayBase */) {
extraArgs.push("--overlay-base");
}
const baselineFilesOptions = config.enableFileCoverageInformation ? [
"--calculate-language-specific-baseline",
"--sublanguage-file-coverage"
] : ["--no-calculate-baseline"];
await runCli(
cmd,
[
@@ -88593,12 +88606,14 @@ async function getCodeQLForCmd(cmd, checkVersion) {
"--db-cluster",
config.dbLocation,
`--source-root=${sourceRoot}`,
"--calculate-language-specific-baseline",
...baselineFilesOptions,
"--extractor-include-aliases",
"--sublanguage-file-coverage",
...extraArgs,
...getExtraOptionsFromEnv(["database", "init"], {
ignoringOptions: ["--overwrite"]
// Some user configs specify `--no-calculate-baseline` as an additional
// argument to `codeql database init`. Therefore ignore the baseline file
// options here to avoid specifying the same argument twice and erroring.
ignoringOptions: ["--overwrite", ...baselineFilesOptions]
})
],
{ stdin: externalRepositoryToken }
@@ -88785,15 +88800,6 @@ ${output}`
noStreamStdout: true
});
},
async databasePrintBaseline(databasePath) {
const codeqlArgs = [
"database",
"print-baseline",
...getExtraOptionsFromEnv(["database", "print-baseline"]),
databasePath
];
return await runCli(cmd, codeqlArgs);
},
async databaseCleanupCluster(config, cleanupLevel) {
const cacheCleanupFlag = await codeQlVersionAtLeast(
this,