From a0d93904eee1fae1eccfec9ef331382f21bb779d Mon Sep 17 00:00:00 2001 From: Ethan Chiu Date: Mon, 15 Jun 2020 11:10:36 -0400 Subject: [PATCH] Fix error + add diagnostics --- .../Handlers/CompositeActionHandler.cs | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/src/Runner.Worker/Handlers/CompositeActionHandler.cs b/src/Runner.Worker/Handlers/CompositeActionHandler.cs index ac95a6c4b..a3e09dd77 100644 --- a/src/Runner.Worker/Handlers/CompositeActionHandler.cs +++ b/src/Runner.Worker/Handlers/CompositeActionHandler.cs @@ -45,7 +45,7 @@ namespace GitHub.Runner.Worker.Handlers } } var contents = runValue ?? string.Empty; - if (Action.Type == Pipelines.ActionSourceType.Script) + if (Action.Type == Pipelines.ActionSourceType.Repository) { var firstLine = contents.TrimStart(' ', '\t', '\r', '\n'); var firstNewLine = firstLine.IndexOfAny(new[] { '\r', '\n' }); @@ -168,11 +168,22 @@ namespace GitHub.Runner.Worker.Handlers // Resolve steps var target = Data.Steps; + if (target == null) { + Trace.Error("Data.Steps in CompositeActionHandler is null"); + } else { + Trace.Info($"Data Steps Value for Composite Actions is: {target}."); + } + // For now, just assume it is 1 Run step // 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? var runStepInputs = target[0].Inputs; + if (runStepInputs == null) { + Trace.Error("runStepInputs in CompositeActionHandler is null"); + } else { + Trace.Info($"runStepInputs Value for Composite Actions is: {runStepInputs}."); + } var templateEvaluator = ExecutionContext.ToPipelineTemplateEvaluator(); var inputs = templateEvaluator.EvaluateStepInputs(runStepInputs, ExecutionContext.ExpressionValues, ExecutionContext.ExpressionFunctions); var taskManager = HostContext.GetService(); @@ -183,7 +194,11 @@ namespace GitHub.Runner.Worker.Handlers { userInputs.Add(input.Key); userInputs.Add(input.Value); - if (input.Key.Equals("run")) + Trace.Info($"Composite Action Handler. Key: {input.Key} Value: {input.Value}"); + // Why is the key should not be "run" => because the "run" keyword is recorgnized as something that will be a "script"? + // Or should we create another key that delineates between "script" and "run"? + // ^ Perhaps we can explore this in the next version with the changes the to action.yaml template + if (input.Key.Equals("script")) { runValue = input.Value; } @@ -198,6 +213,8 @@ namespace GitHub.Runner.Worker.Handlers // In the future, we would apply and validate the template => maybe using the manifest manager to recursively load the json schema. } + Trace.Info($"Run Value for Composite Actions is: {runValue}."); + // Let's think about validating inputs later // Validate inputs only for actions with action.yml // var unexpectedInputs = new List();