Skip to content

Commit 046ce56

Browse files
committed
Overlay: choose database mode without CodeQL CLI
This commit makes getOverlayDatabaseMode() accept undefined as arguments for codeql and languages.
1 parent f6247bb commit 046ce56

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

src/config-utils.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -689,14 +689,17 @@ async function isOverlayAnalysisFeatureEnabled(
689689
* For `Overlay` and `OverlayBase`, the function performs further checks and
690690
* reverts to `None` if any check should fail.
691691
*
692+
* If `codeql` or `languages` is undefined, the function will skip checks that
693+
* depend on them.
694+
*
692695
* @returns An object containing the overlay database mode and whether the
693696
* action should perform overlay-base database caching.
694697
*/
695698
export async function getOverlayDatabaseMode(
696-
codeql: CodeQL,
699+
codeql: CodeQL | undefined,
697700
repository: RepositoryNwo,
698701
features: FeatureEnablement,
699-
languages: Language[],
702+
languages: Language[] | undefined,
700703
languagesInput: string | undefined,
701704
sourceRoot: string,
702705
buildMode: BuildMode | undefined,
@@ -759,6 +762,8 @@ export async function getOverlayDatabaseMode(
759762
}
760763

761764
if (
765+
codeql !== undefined &&
766+
languages !== undefined &&
762767
buildMode !== BuildMode.None &&
763768
(
764769
await Promise.all(
@@ -773,7 +778,10 @@ export async function getOverlayDatabaseMode(
773778
);
774779
return nonOverlayAnalysis;
775780
}
776-
if (!(await codeQlVersionAtLeast(codeql, CODEQL_OVERLAY_MINIMUM_VERSION))) {
781+
if (
782+
codeql !== undefined &&
783+
!(await codeQlVersionAtLeast(codeql, CODEQL_OVERLAY_MINIMUM_VERSION))
784+
) {
777785
logger.warning(
778786
`Cannot build an ${overlayDatabaseMode} database because ` +
779787
`the CodeQL CLI is older than ${CODEQL_OVERLAY_MINIMUM_VERSION}. ` +

0 commit comments

Comments
 (0)