Limit OverlayAnalysis to internal repos

This commit is contained in:
Chuan-kai Lin
2025-07-03 10:02:46 -07:00
parent 93e8729640
commit b4425372ef
2 changed files with 14 additions and 1 deletions

View File

@@ -815,6 +815,7 @@ const calculateAugmentationMacro = test.macro({
const actualAugmentationProperties =
await configUtils.calculateAugmentation(
getCachedCodeQL(),
{ owner: "github", repo: "repo" },
createFeatures([]),
rawPacksInput,
rawQueriesInput,
@@ -946,6 +947,7 @@ const calculateAugmentationErrorMacro = test.macro({
() =>
configUtils.calculateAugmentation(
getCachedCodeQL(),
{ owner: "github", repo: "repo" },
createFeatures([]),
rawPacksInput,
rawQueriesInput,

View File

@@ -494,6 +494,7 @@ export async function getDefaultConfig({
const augmentationProperties = await calculateAugmentation(
codeql,
repository,
features,
packsInput,
queriesInput,
@@ -608,6 +609,7 @@ async function loadConfig({
const augmentationProperties = await calculateAugmentation(
codeql,
repository,
features,
packsInput,
queriesInput,
@@ -651,6 +653,7 @@ async function loadConfig({
* the config file sent to the CLI.
*
* @param codeql The CodeQL object.
* @param repository The repository to analyze.
* @param features The feature enablement object.
* @param rawPacksInput The packs input from the action configuration.
* @param rawQueriesInput The queries input from the action configuration.
@@ -669,6 +672,7 @@ async function loadConfig({
// exported for testing.
export async function calculateAugmentation(
codeql: CodeQL,
repository: RepositoryNwo,
features: FeatureEnablement,
rawPacksInput: string | undefined,
rawQueriesInput: string | undefined,
@@ -691,6 +695,7 @@ export async function calculateAugmentation(
);
const overlayDatabaseMode = await getOverlayDatabaseMode(
codeql,
repository,
features,
languages,
sourceRoot,
@@ -760,6 +765,7 @@ function parseQueriesFromInput(
*/
async function getOverlayDatabaseMode(
codeql: CodeQL,
repository: RepositoryNwo,
features: FeatureEnablement,
languages: Language[],
sourceRoot: string,
@@ -781,7 +787,12 @@ async function getOverlayDatabaseMode(
`Setting overlay database mode to ${overlayDatabaseMode} ` +
"from the CODEQL_OVERLAY_DATABASE_MODE environment variable.",
);
} else if (await features.getValue(Feature.OverlayAnalysis, codeql)) {
} else if (
// TODO: Remove the repository owner check once support for overlay analysis
// stabilizes, and no more backward-incompatible changes are expected.
["github", "dsp-testing"].includes(repository.owner) &&
(await features.getValue(Feature.OverlayAnalysis, codeql))
) {
if (isAnalyzingPullRequest()) {
overlayDatabaseMode = OverlayDatabaseMode.Overlay;
logger.info(