Allow explicit disablement too

This commit is contained in:
Henry Mercer
2026-03-02 19:58:27 +01:00
parent 2a4d1eca6b
commit 9e1b38bcc6
3 changed files with 143 additions and 10 deletions
+16 -2
View File
@@ -109056,18 +109056,32 @@ function cleanupDatabaseClusterDirectory(config, logger, options = {}, rmSync2 =
async function getFileCoverageInformationEnabled(debugMode, repositoryNwo, features, repositoryProperties, logger) {
if (debugMode) return true;
if (!isAnalyzingPullRequest()) return true;
if (process.env["CODEQL_ACTION_ENABLE_FILE_COVERAGE_ON_PRS" /* ENABLE_FILE_COVERAGE_ON_PRS */] === "true") {
const envVarValue = process.env["CODEQL_ACTION_ENABLE_FILE_COVERAGE_ON_PRS" /* ENABLE_FILE_COVERAGE_ON_PRS */];
if (envVarValue === "true") {
logger.info(
`File coverage information on pull requests has been enabled by the '${"CODEQL_ACTION_ENABLE_FILE_COVERAGE_ON_PRS" /* ENABLE_FILE_COVERAGE_ON_PRS */}' environment variable. This may increase the time it takes to analyze pull requests, particularly on large repositories.`
);
return true;
}
if (repositoryProperties["github-codeql-enable-file-coverage-on-prs" /* ENABLE_FILE_COVERAGE_ON_PRS */] === true) {
if (envVarValue === "false") {
logger.info(
`File coverage information on pull requests has been disabled by the '${"CODEQL_ACTION_ENABLE_FILE_COVERAGE_ON_PRS" /* ENABLE_FILE_COVERAGE_ON_PRS */}' environment variable.`
);
return false;
}
const repoPropValue = repositoryProperties["github-codeql-enable-file-coverage-on-prs" /* ENABLE_FILE_COVERAGE_ON_PRS */];
if (repoPropValue === true) {
logger.info(
`File coverage information on pull requests has been enabled by the '${"github-codeql-enable-file-coverage-on-prs" /* ENABLE_FILE_COVERAGE_ON_PRS */}' repository property. This may increase the time it takes to analyze pull requests, particularly on large repositories.`
);
return true;
}
if (repoPropValue === false) {
logger.info(
`File coverage information on pull requests has been disabled by the '${"github-codeql-enable-file-coverage-on-prs" /* ENABLE_FILE_COVERAGE_ON_PRS */}' repository property.`
);
return false;
}
if (repositoryNwo.owner !== "github") return true;
if (!await features.getValue("skip_file_coverage_on_prs" /* SkipFileCoverageOnPrs */)) return true;
return false;