Add env var to enable file coverage on PRs

This commit is contained in:
Henry Mercer
2026-03-02 19:55:35 +01:00
parent 003c59c557
commit 2a4d1eca6b
6 changed files with 119 additions and 8 deletions
+8 -1
View File
@@ -110807,7 +110807,14 @@ async function runQueries(sarifFolder, memoryFlag, threadsFlag, diffRangePackDir
}
if (!config.enableFileCoverageInformation) {
const isOrgOwned = github2.context.payload.repository?.owner.type === "Organization";
const reenableMessage = isOrgOwned ? ` To enable file coverage information on pull requests, set the '${"github-codeql-enable-file-coverage-on-prs" /* ENABLE_FILE_COVERAGE_ON_PRS */}' repository property to 'true'.` : "";
let reenableMessage;
if (isOrgOwned) {
reenableMessage = ` To enable file coverage information on pull requests, set the '${"github-codeql-enable-file-coverage-on-prs" /* ENABLE_FILE_COVERAGE_ON_PRS */}' repository property to 'true'.`;
} else if (!isDefaultSetup()) {
reenableMessage = ` To enable file coverage information on pull requests, set the '${"CODEQL_ACTION_ENABLE_FILE_COVERAGE_ON_PRS" /* ENABLE_FILE_COVERAGE_ON_PRS */}' environment variable to 'true'.`;
} else {
reenableMessage = "";
}
logger.info(
`To speed up pull request analysis, file coverage information is only enabled when analyzing the default branch and protected branches.${reenableMessage}`
);
+7 -1
View File
@@ -109056,9 +109056,15 @@ 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") {
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) {
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 will increase the time it takes to analyze pull requests, particularly on large repositories.`
`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;
}