@@ -37,7 +37,7 @@ import {
3737 makeTelemetryDiagnostic ,
3838} from "./diagnostics" ;
3939import { EnvVar } from "./environment" ;
40- import { Feature , Features } from "./feature-flags" ;
40+ import { Feature , FeatureEnablement , Features } from "./feature-flags" ;
4141import { loadPropertiesFromApi } from "./feature-flags/properties" ;
4242import {
4343 checkInstallPython311 ,
@@ -54,7 +54,7 @@ import {
5454 OverlayBaseDatabaseDownloadStats ,
5555 OverlayDatabaseMode ,
5656} from "./overlay-database-utils" ;
57- import { getRepositoryNwo } from "./repository" ;
57+ import { getRepositoryNwo , RepositoryNwo } from "./repository" ;
5858import { ToolsSource } from "./setup-codeql" ;
5959import {
6060 ActionName ,
@@ -366,16 +366,11 @@ async function run(startedAt: Date) {
366366 apiDetails,
367367 features,
368368 repositoryProperties,
369- enableFileCoverageInformation :
370- // Always enable file coverage information in debug mode
371- debugMode ||
372- // We're most interested in speeding up PRs, and we want to keep
373- // submitting file coverage information for the default branch since
374- // it is used to populate the status page.
375- ! isAnalyzingPullRequest ( ) ||
376- // For now, restrict this feature to the GitHub org
377- repositoryNwo . owner !== "github" ||
378- ! ( await features . getValue ( Feature . SkipFileCoverageOnPrs ) ) ,
369+ enableFileCoverageInformation : await getFileCoverageInformationEnabled (
370+ debugMode ,
371+ repositoryNwo ,
372+ features ,
373+ ) ,
379374 logger,
380375 } ) ;
381376
@@ -799,6 +794,24 @@ function getTrapCachingEnabled(): boolean {
799794 return true ;
800795}
801796
797+ async function getFileCoverageInformationEnabled (
798+ debugMode : boolean ,
799+ repositoryNwo : RepositoryNwo ,
800+ features : FeatureEnablement ,
801+ ) : Promise < boolean > {
802+ return (
803+ // Always enable file coverage information in debug mode
804+ debugMode ||
805+ // We're most interested in speeding up PRs, and we want to keep
806+ // submitting file coverage information for the default branch since
807+ // it is used to populate the status page.
808+ ! isAnalyzingPullRequest ( ) ||
809+ // For now, restrict this feature to the GitHub org
810+ repositoryNwo . owner !== "github" ||
811+ ! ( await features . getValue ( Feature . SkipFileCoverageOnPrs ) )
812+ ) ;
813+ }
814+
802815async function recordZstdAvailability (
803816 config : configUtils . Config ,
804817 zstdAvailability : ZstdAvailability ,
0 commit comments