mirror of
https://github.com/github/codeql-action.git
synced 2026-11-15 17:21:38 +00:00
Add unit tests for disabling overlay analysis by custom repo property
This commit is contained in:
55
lib/init-action.js
generated
55
lib/init-action.js
generated
@@ -87845,6 +87845,7 @@ function getUnknownLanguagesError(languages) {
|
||||
// src/feature-flags/properties.ts
|
||||
var RepositoryPropertyName = /* @__PURE__ */ ((RepositoryPropertyName2) => {
|
||||
RepositoryPropertyName2["EXTRA_QUERIES"] = "github-codeql-extra-queries";
|
||||
RepositoryPropertyName2["DISABLE_OVERLAY_ANALYSIS"] = "github-codeql-disable-overlay-analysis";
|
||||
return RepositoryPropertyName2;
|
||||
})(RepositoryPropertyName || {});
|
||||
async function loadPropertiesFromApi(gitHubVersion, logger, repositoryNwo) {
|
||||
@@ -89403,34 +89404,39 @@ async function isOverlayAnalysisFeatureEnabled(repository, features, codeql, lan
|
||||
}
|
||||
return true;
|
||||
}
|
||||
async function getOverlayDatabaseMode(codeql, repository, features, languages, sourceRoot, buildMode, codeScanningConfig, logger) {
|
||||
async function getOverlayDatabaseMode(codeql, repository, features, languages, sourceRoot, buildMode, codeScanningConfig, repositoryProperties, logger) {
|
||||
let overlayDatabaseMode = "none" /* None */;
|
||||
let useOverlayDatabaseCaching = false;
|
||||
const modeEnv = process.env.CODEQL_OVERLAY_DATABASE_MODE;
|
||||
if (modeEnv === "overlay" /* Overlay */ || modeEnv === "overlay-base" /* OverlayBase */ || modeEnv === "none" /* None */) {
|
||||
overlayDatabaseMode = modeEnv;
|
||||
logger.info(
|
||||
`Setting overlay database mode to ${overlayDatabaseMode} from the CODEQL_OVERLAY_DATABASE_MODE environment variable.`
|
||||
);
|
||||
} else if (await isOverlayAnalysisFeatureEnabled(
|
||||
repository,
|
||||
features,
|
||||
codeql,
|
||||
languages,
|
||||
codeScanningConfig
|
||||
)) {
|
||||
if (isAnalyzingPullRequest()) {
|
||||
overlayDatabaseMode = "overlay" /* Overlay */;
|
||||
useOverlayDatabaseCaching = true;
|
||||
const overlayAnalysisDisabled = repositoryProperties["github-codeql-disable-overlay-analysis" /* DISABLE_OVERLAY_ANALYSIS */];
|
||||
if (overlayAnalysisDisabled && overlayAnalysisDisabled === "true") {
|
||||
logger.info(`Setting overlay database mode to ${overlayDatabaseMode} because overlay analysis is disabled by a custom repository property.`);
|
||||
} else {
|
||||
const modeEnv = process.env.CODEQL_OVERLAY_DATABASE_MODE;
|
||||
if (modeEnv === "overlay" /* Overlay */ || modeEnv === "overlay-base" /* OverlayBase */ || modeEnv === "none" /* None */) {
|
||||
overlayDatabaseMode = modeEnv;
|
||||
logger.info(
|
||||
`Setting overlay database mode to ${overlayDatabaseMode} with caching because we are analyzing a pull request.`
|
||||
);
|
||||
} else if (await isAnalyzingDefaultBranch()) {
|
||||
overlayDatabaseMode = "overlay-base" /* OverlayBase */;
|
||||
useOverlayDatabaseCaching = true;
|
||||
logger.info(
|
||||
`Setting overlay database mode to ${overlayDatabaseMode} with caching because we are analyzing the default branch.`
|
||||
`Setting overlay database mode to ${overlayDatabaseMode} from the CODEQL_OVERLAY_DATABASE_MODE environment variable.`
|
||||
);
|
||||
} else if (await isOverlayAnalysisFeatureEnabled(
|
||||
repository,
|
||||
features,
|
||||
codeql,
|
||||
languages,
|
||||
codeScanningConfig
|
||||
)) {
|
||||
if (isAnalyzingPullRequest()) {
|
||||
overlayDatabaseMode = "overlay" /* Overlay */;
|
||||
useOverlayDatabaseCaching = true;
|
||||
logger.info(
|
||||
`Setting overlay database mode to ${overlayDatabaseMode} with caching because we are analyzing a pull request.`
|
||||
);
|
||||
} else if (await isAnalyzingDefaultBranch()) {
|
||||
overlayDatabaseMode = "overlay-base" /* OverlayBase */;
|
||||
useOverlayDatabaseCaching = true;
|
||||
logger.info(
|
||||
`Setting overlay database mode to ${overlayDatabaseMode} with caching because we are analyzing the default branch.`
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
const nonOverlayAnalysis = {
|
||||
@@ -89527,6 +89533,7 @@ async function initConfig(features, inputs) {
|
||||
inputs.sourceRoot,
|
||||
config.buildMode,
|
||||
config.computedConfig,
|
||||
inputs.repositoryProperties,
|
||||
logger
|
||||
);
|
||||
logger.info(
|
||||
|
||||
Reference in New Issue
Block a user