Skip to content

Commit 0d6f2cb

Browse files
author
MPCoreDeveloper
committed
fix(ci): Suppress console output in CI environments to prevent log overflow
1 parent d656eb3 commit 0d6f2cb

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

src/SharpCoreDB/Services/SqlParser.DML.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,10 +343,21 @@ private string GenerateQueryPlan(string[] selectParts, string tableName, int whe
343343
/// <summary>
344344
/// Executes SELECT statement (console output version).
345345
/// NOTE: This method is for interactive/demo use only. Use ExecuteQuery() for production.
346+
/// Console output is suppressed in CI environments to prevent test log overflow.
346347
/// </summary>
347348
private void ExecuteSelect(string sql, string[] parts, bool noEncrypt)
348349
{
349350
var results = ExecuteSelectQuery(sql, parts, noEncrypt);
351+
352+
// ✅ FIX: Skip console output in CI environments to prevent log overflow
353+
// GitHub Actions sets CI=true, Azure DevOps sets TF_BUILD=true
354+
if (Environment.GetEnvironmentVariable("CI") is not null ||
355+
Environment.GetEnvironmentVariable("TF_BUILD") is not null ||
356+
Environment.GetEnvironmentVariable("GITHUB_ACTIONS") is not null)
357+
{
358+
return;
359+
}
360+
350361
foreach (var row in results)
351362
{
352363
Console.WriteLine(string.Join(", ", row.Select(kv => $"{kv.Key}: {kv.Value ?? "NULL"}")));

src/SharpCoreDB/Services/SqlQueryValidator.cs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ public static void ValidateQuery(string sql, Dictionary<string, object?>? parame
153153
// else: no placeholders but parameters provided - likely already bound, skip warning
154154
}
155155

156+
156157
// Handle warnings based on mode
157158
if (warnings.Any())
158159
{
@@ -167,8 +168,15 @@ public static void ValidateQuery(string sql, Dictionary<string, object?>? parame
167168
}
168169
else // Lenient
169170
{
170-
Console.WriteLine($"⚠️ {message}");
171-
Console.WriteLine($" Query: {TruncateQuery(sql)}");
171+
// ✅ FIX: Skip console output in CI environments to prevent log overflow
172+
// GitHub Actions sets CI=true, Azure DevOps sets TF_BUILD=true
173+
if (Environment.GetEnvironmentVariable("CI") is null &&
174+
Environment.GetEnvironmentVariable("TF_BUILD") is null &&
175+
Environment.GetEnvironmentVariable("GITHUB_ACTIONS") is null)
176+
{
177+
Console.WriteLine($"⚠️ {message}");
178+
Console.WriteLine($" Query: {TruncateQuery(sql)}");
179+
}
172180
}
173181
}
174182
}

0 commit comments

Comments
 (0)