Resolve build errors

This commit is contained in:
Ethan Chiu
2020-06-15 09:12:54 -04:00
parent 885a128fa5
commit 85796d0011
3 changed files with 27 additions and 11 deletions

View File

@@ -29,7 +29,7 @@ namespace GitHub.Runner.Worker.Handlers
{ {
// Just keep as same as ScriptHandler.cs for now // Just keep as same as ScriptHandler.cs for now
var target = Data.Steps; var target = Data.Steps;
var runStepInputs= target[0].Inputs; var runStepInputs = target[0].Inputs;
var templateEvaluator = ExecutionContext.ToPipelineTemplateEvaluator(); var templateEvaluator = ExecutionContext.ToPipelineTemplateEvaluator();
var inputs = templateEvaluator.EvaluateStepInputs(runStepInputs, ExecutionContext.ExpressionValues, ExecutionContext.ExpressionFunctions); var inputs = templateEvaluator.EvaluateStepInputs(runStepInputs, ExecutionContext.ExpressionValues, ExecutionContext.ExpressionFunctions);
var taskManager = HostContext.GetService<IActionManager>(); var taskManager = HostContext.GetService<IActionManager>();
@@ -61,7 +61,7 @@ namespace GitHub.Runner.Worker.Handlers
throw new InvalidOperationException($"Invalid action type {Action.Type} for {nameof(ScriptHandler)}"); throw new InvalidOperationException($"Invalid action type {Action.Type} for {nameof(ScriptHandler)}");
} }
ar multiLines = contents.Replace("\r\n", "\n").TrimEnd('\n').Split('\n'); var multiLines = contents.Replace("\r\n", "\n").TrimEnd('\n').Split('\n');
foreach (var line in multiLines) foreach (var line in multiLines)
{ {
// Bright Cyan color // Bright Cyan color
@@ -172,7 +172,7 @@ namespace GitHub.Runner.Worker.Handlers
// For now, just assume it is 1 Run step // For now, just assume it is 1 Run step
// We will adapt this in the future. // We will adapt this in the future.
// Copied from ActionRunner.cs RunAsync() function => Maybe we don't need a handler and need to avoid this preplicatoin in the future? // Copied from ActionRunner.cs RunAsync() function => Maybe we don't need a handler and need to avoid this preplicatoin in the future?
var runStepInputs= target[0].Inputs; var runStepInputs = target[0].Inputs;
var templateEvaluator = ExecutionContext.ToPipelineTemplateEvaluator(); var templateEvaluator = ExecutionContext.ToPipelineTemplateEvaluator();
var inputs = templateEvaluator.EvaluateStepInputs(runStepInputs, ExecutionContext.ExpressionValues, ExecutionContext.ExpressionFunctions); var inputs = templateEvaluator.EvaluateStepInputs(runStepInputs, ExecutionContext.ExpressionValues, ExecutionContext.ExpressionFunctions);
var taskManager = HostContext.GetService<IActionManager>(); var taskManager = HostContext.GetService<IActionManager>();
@@ -228,6 +228,23 @@ namespace GitHub.Runner.Worker.Handlers
var contents = runValue ?? string.Empty; var contents = runValue ?? string.Empty;
string workingDirectory = null;
if (!Inputs.TryGetValue("workingDirectory", out workingDirectory))
{
// TODO: figure out how defaults interact with template later
// for now, we won't check job.defaults if we are inside a template.
if (string.IsNullOrEmpty(ExecutionContext.ScopeName) && ExecutionContext.JobDefaults.TryGetValue("run", out var runDefaults))
{
if (runDefaults.TryGetValue("working-directory", out workingDirectory))
{
ExecutionContext.Debug("Overwrite 'working-directory' base on job defaults.");
}
}
}
var workspaceDir = githubContext["workspace"] as StringContextData;
workingDirectory = Path.Combine(workspaceDir, workingDirectory ?? string.Empty);
string shell = null; string shell = null;
if (!Inputs.TryGetValue("shell", out shell) || string.IsNullOrEmpty(shell)) if (!Inputs.TryGetValue("shell", out shell) || string.IsNullOrEmpty(shell))
{ {
@@ -361,6 +378,5 @@ namespace GitHub.Runner.Worker.Handlers
} }
} }
}
} }
} }

View File

@@ -70,9 +70,9 @@ namespace GitHub.Runner.Worker.Handlers
{ {
// TODO // TODO
// Runner plugin // Runner plugin
handler = HostContext.CreateService<ICompositeHandler>(); handler = HostContext.CreateService<ICompositeActionHandler>();
// handler = CompositeHandler; // handler = CompositeHandler;
(handler as ICompositeHandler).Data = data as CompositeActionExecutionData; (handler as ICompositeActionHandler).Data = data as CompositeActionExecutionData;
} }
else else
{ {

View File

@@ -289,8 +289,8 @@ namespace GitHub.Runner.Worker
// TODO: Maybe add EvaluateStep stuff here too? // TODO: Maybe add EvaluateStep stuff here too?
// TODO: INSERT CONVERTSTEPS FUNCTION HERE FOR EVALUATING STEPS // TODO: INSERT CONVERTSTEPS FUNCTION HERE FOR EVALUATING STEPS
// Maybe we don't need to do this here do we need to initialize the job? // Maybe we don't need to do this here do we need to initialize the job?
context.Debug("Evaluating job evaluating steps"); // context.Debug("Evaluating job evaluating steps");
var stepsEvaluation = templateEvaluator.EvaluateSteps(contextData, context, context.ExpressionFunctions); // var stepsEvaluation = templateEvaluator.EvaluateSteps(contextData, context, context.ExpressionFunctions);
//////// ////////
} }