mirror of
https://github.com/github/codeql-action.git
synced 2026-05-12 00:30:10 +00:00
Add dry run mode so we can dark ship
This commit is contained in:
Generated
+49
-5
@@ -165864,6 +165864,16 @@ function writeDiagnostic(config, language, diagnostic) {
|
||||
logger.debug(JSON.stringify(diagnostic));
|
||||
}
|
||||
}
|
||||
function makeTelemetryDiagnostic(id, name, attributes) {
|
||||
return makeDiagnostic(id, name, {
|
||||
attributes,
|
||||
visibility: {
|
||||
cliSummaryTable: false,
|
||||
statusPage: false,
|
||||
telemetry: true
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// src/diff-informed-analysis-utils.ts
|
||||
var fs6 = __toESM(require("fs"));
|
||||
@@ -166384,6 +166394,11 @@ var featureConfig = {
|
||||
envVar: "CODEQL_ACTION_OVERLAY_ANALYSIS_MATCH_CODEQL_VERSION",
|
||||
minimumVersion: void 0
|
||||
},
|
||||
["overlay_analysis_match_codeql_version_dry_run" /* OverlayAnalysisMatchCodeqlVersionDryRun */]: {
|
||||
defaultValue: false,
|
||||
envVar: "CODEQL_ACTION_OVERLAY_ANALYSIS_MATCH_CODEQL_VERSION_DRY_RUN",
|
||||
minimumVersion: void 0
|
||||
},
|
||||
["overlay_analysis_resource_checks_v2" /* OverlayAnalysisResourceChecksV2 */]: {
|
||||
defaultValue: false,
|
||||
envVar: "CODEQL_ACTION_OVERLAY_ANALYSIS_RESOURCE_CHECKS_V2",
|
||||
@@ -167548,7 +167563,11 @@ async function getEnabledVersionsWithOverlayBaseDatabases(defaultCliVersion, raw
|
||||
if (rawLanguages === void 0 || rawLanguages.length === 0) {
|
||||
return [];
|
||||
}
|
||||
if (!await features.getValue("overlay_analysis_match_codeql_version" /* OverlayAnalysisMatchCodeqlVersion */)) {
|
||||
const isEnabled = await features.getValue(
|
||||
"overlay_analysis_match_codeql_version" /* OverlayAnalysisMatchCodeqlVersion */
|
||||
);
|
||||
const isDryRun = !isEnabled && await features.getValue("overlay_analysis_match_codeql_version_dry_run" /* OverlayAnalysisMatchCodeqlVersionDryRun */);
|
||||
if (!isEnabled && !isDryRun) {
|
||||
return [];
|
||||
}
|
||||
let cachedVersions;
|
||||
@@ -167567,9 +167586,37 @@ async function getEnabledVersionsWithOverlayBaseDatabases(defaultCliVersion, raw
|
||||
return [];
|
||||
}
|
||||
const cachedVersionsSet = new Set(cachedVersions);
|
||||
return defaultCliVersion.enabledVersions.filter(
|
||||
const overlayVersions = defaultCliVersion.enabledVersions.filter(
|
||||
(v) => cachedVersionsSet.has(v.cliVersion)
|
||||
);
|
||||
if (overlayVersions.length === 0) {
|
||||
return [];
|
||||
}
|
||||
const isCachedVersionDifferent = overlayVersions[0].cliVersion !== defaultCliVersion.enabledVersions[0].cliVersion;
|
||||
if (isCachedVersionDifferent) {
|
||||
addNoLanguageDiagnostic(
|
||||
void 0,
|
||||
makeTelemetryDiagnostic(
|
||||
"codeql-action/overlay-aware-default-codeql-version",
|
||||
"Overlay-aware default CodeQL version selection",
|
||||
{
|
||||
cachedVersions,
|
||||
enabledVersions: defaultCliVersion.enabledVersions.map(
|
||||
(v) => v.cliVersion
|
||||
),
|
||||
isDryRun,
|
||||
overlayAwareVersion: overlayVersions[0].cliVersion
|
||||
}
|
||||
)
|
||||
);
|
||||
}
|
||||
if (isDryRun) {
|
||||
logger.debug(
|
||||
`Overlay-aware default CodeQL version selection is running in dry-run mode. Would have used version ${overlayVersions[0].cliVersion}.`
|
||||
);
|
||||
return [];
|
||||
}
|
||||
return overlayVersions;
|
||||
}
|
||||
async function resolveDefaultCliVersion(defaultCliVersion, rawLanguages, features, logger) {
|
||||
if (!isAnalyzingPullRequest()) {
|
||||
@@ -167587,9 +167634,6 @@ async function resolveDefaultCliVersion(defaultCliVersion, rawLanguages, feature
|
||||
);
|
||||
return overlayVersions[0];
|
||||
}
|
||||
logger.info(
|
||||
`Using CodeQL version ${defaultCliVersion.enabledVersions[0].cliVersion} since no enabled versions with cached overlay-base databases were found.`
|
||||
);
|
||||
return defaultCliVersion.enabledVersions[0];
|
||||
}
|
||||
async function getCodeQLSource(toolsInput, defaultCliVersion, rawLanguages, apiDetails, variant, tarSupportsZstd, features, logger) {
|
||||
|
||||
Reference in New Issue
Block a user