Fix expression parsing (partially)

This commit is contained in:
Francesco Renzi
2026-01-15 16:05:01 +00:00
committed by GitHub
parent 7e4f99337f
commit f45c5d0785

View File

@@ -510,11 +510,20 @@ namespace GitHub.Runner.Worker.Dap
try try
{ {
// Check if this is a REPL/shell command (context: "repl") or starts with shell prefix // GitHub Actions expressions start with "${{" - always evaluate as expressions
if (evalContext == "repl" || expression.StartsWith("!") || expression.StartsWith("$")) if (expression.StartsWith("${{"))
{
var result = EvaluateExpression(expression, executionContext);
return CreateSuccessResponse(result);
}
// Check if this is a REPL/shell command:
// - context is "repl" (from Debug Console pane)
// - expression starts with "!" (explicit shell prefix for Watch pane)
if (evalContext == "repl" || expression.StartsWith("!"))
{ {
// Shell execution mode // Shell execution mode
var command = expression.TrimStart('!', '$').Trim(); var command = expression.TrimStart('!').Trim();
if (string.IsNullOrEmpty(command)) if (string.IsNullOrEmpty(command))
{ {
return CreateSuccessResponse(new EvaluateResponseBody return CreateSuccessResponse(new EvaluateResponseBody
@@ -530,7 +539,7 @@ namespace GitHub.Runner.Worker.Dap
} }
else else
{ {
// Expression evaluation mode // Expression evaluation mode (Watch pane, hover, etc.)
var result = EvaluateExpression(expression, executionContext); var result = EvaluateExpression(expression, executionContext);
return CreateSuccessResponse(result); return CreateSuccessResponse(result);
} }