Skip to content

Commit 3207936

Browse files
committed
Limit OverlayAnalysis to internal repos
1 parent 173df96 commit 3207936

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

src/config-utils.test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -815,6 +815,7 @@ const calculateAugmentationMacro = test.macro({
815815
const actualAugmentationProperties =
816816
await configUtils.calculateAugmentation(
817817
getCachedCodeQL(),
818+
{ owner: "github", repo: "repo" },
818819
createFeatures([]),
819820
rawPacksInput,
820821
rawQueriesInput,
@@ -946,6 +947,7 @@ const calculateAugmentationErrorMacro = test.macro({
946947
() =>
947948
configUtils.calculateAugmentation(
948949
getCachedCodeQL(),
950+
{ owner: "github", repo: "repo" },
949951
createFeatures([]),
950952
rawPacksInput,
951953
rawQueriesInput,

src/config-utils.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -494,6 +494,7 @@ export async function getDefaultConfig({
494494

495495
const augmentationProperties = await calculateAugmentation(
496496
codeql,
497+
repository,
497498
features,
498499
packsInput,
499500
queriesInput,
@@ -608,6 +609,7 @@ async function loadConfig({
608609

609610
const augmentationProperties = await calculateAugmentation(
610611
codeql,
612+
repository,
611613
features,
612614
packsInput,
613615
queriesInput,
@@ -651,6 +653,7 @@ async function loadConfig({
651653
* the config file sent to the CLI.
652654
*
653655
* @param codeql The CodeQL object.
656+
* @param repository The repository to analyze.
654657
* @param features The feature enablement object.
655658
* @param rawPacksInput The packs input from the action configuration.
656659
* @param rawQueriesInput The queries input from the action configuration.
@@ -669,6 +672,7 @@ async function loadConfig({
669672
// exported for testing.
670673
export async function calculateAugmentation(
671674
codeql: CodeQL,
675+
repository: RepositoryNwo,
672676
features: FeatureEnablement,
673677
rawPacksInput: string | undefined,
674678
rawQueriesInput: string | undefined,
@@ -691,6 +695,7 @@ export async function calculateAugmentation(
691695
);
692696
const overlayDatabaseMode = await getOverlayDatabaseMode(
693697
codeql,
698+
repository,
694699
features,
695700
sourceRoot,
696701
buildMode,
@@ -759,6 +764,7 @@ function parseQueriesFromInput(
759764
*/
760765
async function getOverlayDatabaseMode(
761766
codeql: CodeQL,
767+
repository: RepositoryNwo,
762768
features: FeatureEnablement,
763769
sourceRoot: string,
764770
buildMode: BuildMode | undefined,
@@ -779,7 +785,10 @@ async function getOverlayDatabaseMode(
779785
`Setting overlay database mode to ${overlayDatabaseMode} ` +
780786
"from the CODEQL_OVERLAY_DATABASE_MODE environment variable.",
781787
);
782-
} else if (await features.getValue(Feature.OverlayAnalysis, codeql)) {
788+
} else if (
789+
["github", "dsp-testing"].includes(repository.owner) &&
790+
(await features.getValue(Feature.OverlayAnalysis, codeql))
791+
) {
783792
if (isAnalyzingPullRequest()) {
784793
overlayDatabaseMode = OverlayDatabaseMode.Overlay;
785794
logger.info(

0 commit comments

Comments
 (0)