Add logging and telemetry for mode

This commit is contained in:
Óscar San José
2026-06-01 18:44:55 +02:00
parent d426d33115
commit 6963dfbbc5
7 changed files with 265 additions and 27 deletions
+46 -10
View File
@@ -158746,12 +158746,16 @@ var io7 = __toESM(require_io());
var semver10 = __toESM(require_semver2());
// src/config/resolve-tools-input.ts
function resolveToolsInput(toolsWorkflowInput, isDynamicWorkflow2, repositoryProperties, logger) {
function resolveToolsInputWithMetadata(toolsWorkflowInput, isDynamicWorkflow2, repositoryProperties, logger) {
if (toolsWorkflowInput) {
logger.info(
`Setting tools: ${toolsWorkflowInput} based on workflow input.`
);
return toolsWorkflowInput;
return {
effectiveToolsInput: toolsWorkflowInput,
effectiveToolsInputSource: "workflow-input" /* WorkflowInput */,
toolsRepoPropertyMode: void 0
};
}
const toolsPropertyValue = repositoryProperties["github-codeql-tools" /* TOOLS */];
const toolsMode = repositoryProperties["github-codeql-tools-mode" /* TOOLS_MODE */] ?? "enforce" /* Enforce */;
@@ -158759,15 +158763,27 @@ function resolveToolsInput(toolsWorkflowInput, isDynamicWorkflow2, repositoryPro
logger.info(
`Ignoring '${"github-codeql-tools" /* TOOLS */}' repository property because '${"github-codeql-tools-mode" /* TOOLS_MODE */}' is set to '${toolsMode}' and this is not a dynamic workflow.`
);
return void 0;
return {
effectiveToolsInput: void 0,
effectiveToolsInputSource: "none" /* None */,
toolsRepoPropertyMode: toolsMode
};
}
if (toolsPropertyValue) {
logger.info(
`Setting tools: ${toolsPropertyValue} based on the '${"github-codeql-tools" /* TOOLS */}' repository property.`
`Setting tools: ${toolsPropertyValue} based on the '${"github-codeql-tools" /* TOOLS */}' repository property (mode: '${toolsMode}').`
);
return toolsPropertyValue;
return {
effectiveToolsInput: toolsPropertyValue,
effectiveToolsInputSource: "repository-property" /* RepositoryProperty */,
toolsRepoPropertyMode: toolsMode
};
}
return void 0;
return {
effectiveToolsInput: void 0,
effectiveToolsInputSource: "none" /* None */,
toolsRepoPropertyMode: void 0
};
}
// src/workflow.ts
@@ -159060,7 +159076,7 @@ async function sendStartingStatusReport(startedAt, config, logger) {
await sendStatusReport(statusReportBase);
}
}
async function sendCompletedStatusReport2(startedAt, config, configFile, toolsDownloadStatusReport, toolsFeatureFlagsValid, toolsSource, toolsVersion, effectiveToolsInput, overlayBaseDatabaseStats, dependencyCachingResults, logger, error3) {
async function sendCompletedStatusReport2(startedAt, config, configFile, toolsDownloadStatusReport, toolsFeatureFlagsValid, toolsSource, toolsVersion, effectiveToolsInput, effectiveToolsInputSource, toolsRepoPropertyMode, overlayBaseDatabaseStats, dependencyCachingResults, logger, error3) {
const statusReportBase = await createStatusReportBase(
"init" /* Init */,
getActionsStatus(error3),
@@ -159079,6 +159095,8 @@ async function sendCompletedStatusReport2(startedAt, config, configFile, toolsDo
...statusReportBase,
tools_input: getOptionalInput("tools") || "",
effective_tools_input: effectiveToolsInput || "",
effective_tools_input_source: effectiveToolsInputSource,
tools_repo_property_mode: toolsRepoPropertyMode || "",
tools_resolved_version: toolsVersion,
tools_source: toolsSource || "UNKNOWN" /* Unknown */,
workflow_languages: workflowLanguages || ""
@@ -159123,6 +159141,8 @@ async function run3(startedAt) {
let toolsVersion;
let zstdAvailability;
let effectiveToolsInput;
let effectiveToolsInputSource = "none" /* None */;
let toolsRepoPropertyMode;
try {
initializeEnvironment(getActionVersion());
persistInputs();
@@ -159172,12 +159192,15 @@ async function run3(startedAt) {
}
const codeQLDefaultVersionInfo = await features.getEnabledDefaultCliVersions(gitHubVersion.type);
toolsFeatureFlagsValid = codeQLDefaultVersionInfo.toolsFeatureFlagsValid;
effectiveToolsInput = resolveToolsInput(
const resolvedToolsInput = resolveToolsInputWithMetadata(
getOptionalInput("tools"),
isDynamicWorkflow(),
repositoryProperties,
logger
);
effectiveToolsInput = resolvedToolsInput.effectiveToolsInput;
effectiveToolsInputSource = resolvedToolsInput.effectiveToolsInputSource;
toolsRepoPropertyMode = resolvedToolsInput.toolsRepoPropertyMode;
const rawLanguages = getRawLanguagesNoAutodetect(
getOptionalInput("languages")
);
@@ -159517,6 +159540,8 @@ exec ${goBinaryPath} "$@"`
toolsSource,
toolsVersion,
effectiveToolsInput,
effectiveToolsInputSource,
toolsRepoPropertyMode,
overlayBaseDatabaseStats,
dependencyCachingStatus,
logger,
@@ -159535,6 +159560,8 @@ exec ${goBinaryPath} "$@"`
toolsSource,
toolsVersion,
effectiveToolsInput,
effectiveToolsInputSource,
toolsRepoPropertyMode,
overlayBaseDatabaseStats,
dependencyCachingStatus,
logger
@@ -160108,7 +160135,7 @@ async function runWrapper6() {
// src/setup-codeql-action.ts
var core24 = __toESM(require_core());
async function sendCompletedStatusReport3(startedAt, toolsDownloadStatusReport, toolsFeatureFlagsValid, toolsSource, toolsVersion, effectiveToolsInput, logger, error3) {
async function sendCompletedStatusReport3(startedAt, toolsDownloadStatusReport, toolsFeatureFlagsValid, toolsSource, toolsVersion, effectiveToolsInput, effectiveToolsInputSource, toolsRepoPropertyMode, logger, error3) {
const statusReportBase = await createStatusReportBase(
"setup-codeql" /* SetupCodeQL */,
getActionsStatus(error3),
@@ -160126,6 +160153,8 @@ async function sendCompletedStatusReport3(startedAt, toolsDownloadStatusReport,
...statusReportBase,
tools_input: getOptionalInput("tools") || "",
effective_tools_input: effectiveToolsInput || "",
effective_tools_input_source: effectiveToolsInputSource,
tools_repo_property_mode: toolsRepoPropertyMode || "",
tools_resolved_version: toolsVersion,
tools_source: toolsSource || "UNKNOWN" /* Unknown */,
workflow_languages: ""
@@ -160147,6 +160176,8 @@ async function run6(startedAt) {
let toolsSource;
let toolsVersion;
let effectiveToolsInput;
let effectiveToolsInputSource = "none" /* None */;
let toolsRepoPropertyMode;
try {
initializeEnvironment(getActionVersion());
const apiDetails = {
@@ -160186,12 +160217,15 @@ async function run6(startedAt) {
logger
);
const repositoryProperties = repositoryPropertiesResult.orElse({});
effectiveToolsInput = resolveToolsInput(
const resolvedToolsInput = resolveToolsInputWithMetadata(
getOptionalInput("tools"),
isDynamicWorkflow(),
repositoryProperties,
logger
);
effectiveToolsInput = resolvedToolsInput.effectiveToolsInput;
effectiveToolsInputSource = resolvedToolsInput.effectiveToolsInputSource;
toolsRepoPropertyMode = resolvedToolsInput.toolsRepoPropertyMode;
const rawLanguages = getRawLanguagesNoAutodetect(
getOptionalInput("languages")
);
@@ -160239,6 +160273,8 @@ async function run6(startedAt) {
toolsSource,
toolsVersion,
effectiveToolsInput,
effectiveToolsInputSource,
toolsRepoPropertyMode,
logger
);
}