Overlay: choose database mode without CodeQL CLI

This commit makes getOverlayDatabaseMode() accept undefined as arguments
for codeql and languages.
This commit is contained in:
Chuan-kai Lin
2025-09-22 13:42:37 -07:00
parent f6247bb37b
commit 046ce56f57
+11 -3
View File
@@ -689,14 +689,17 @@ async function isOverlayAnalysisFeatureEnabled(
* For `Overlay` and `OverlayBase`, the function performs further checks and
* reverts to `None` if any check should fail.
*
* If `codeql` or `languages` is undefined, the function will skip checks that
* depend on them.
*
* @returns An object containing the overlay database mode and whether the
* action should perform overlay-base database caching.
*/
export async function getOverlayDatabaseMode(
codeql: CodeQL,
codeql: CodeQL | undefined,
repository: RepositoryNwo,
features: FeatureEnablement,
languages: Language[],
languages: Language[] | undefined,
languagesInput: string | undefined,
sourceRoot: string,
buildMode: BuildMode | undefined,
@@ -759,6 +762,8 @@ export async function getOverlayDatabaseMode(
}
if (
codeql !== undefined &&
languages !== undefined &&
buildMode !== BuildMode.None &&
(
await Promise.all(
@@ -773,7 +778,10 @@ export async function getOverlayDatabaseMode(
);
return nonOverlayAnalysis;
}
if (!(await codeQlVersionAtLeast(codeql, CODEQL_OVERLAY_MINIMUM_VERSION))) {
if (
codeql !== undefined &&
!(await codeQlVersionAtLeast(codeql, CODEQL_OVERLAY_MINIMUM_VERSION))
) {
logger.warning(
`Cannot build an ${overlayDatabaseMode} database because ` +
`the CodeQL CLI is older than ${CODEQL_OVERLAY_MINIMUM_VERSION}. ` +