diff --git a/src/Runner.Worker/ActionManager.cs b/src/Runner.Worker/ActionManager.cs index 807f5ec66..c08381211 100644 --- a/src/Runner.Worker/ActionManager.cs +++ b/src/Runner.Worker/ActionManager.cs @@ -195,6 +195,7 @@ namespace GitHub.Runner.Worker Data = new ActionDefinitionData() }; + // bool localAction = false; if (action.Reference.Type == Pipelines.ActionSourceType.ContainerRegistry) { Trace.Info("Load action that reference container from registry."); @@ -213,6 +214,7 @@ namespace GitHub.Runner.Worker var repoAction = action.Reference as Pipelines.RepositoryPathReference; if (string.Equals(repoAction.RepositoryType, Pipelines.PipelineConstants.SelfAlias, StringComparison.OrdinalIgnoreCase)) { + // localAction = true; actionDirectory = executionContext.GetGitHubContext("workspace"); if (!string.IsNullOrEmpty(repoAction.Path)) { @@ -272,6 +274,11 @@ namespace GitHub.Runner.Worker Trace.Info($"Action container env: {StringUtil.ConvertToJson(containerAction.Environment)}."); } + if (!string.IsNullOrEmpty(containerAction.Init)) + { + Trace.Info($"Action container init entrypoint: {containerAction.Init}."); + } + if (!string.IsNullOrEmpty(containerAction.EntryPoint)) { Trace.Info($"Action container entrypoint: {containerAction.EntryPoint}."); @@ -291,6 +298,7 @@ namespace GitHub.Runner.Worker else if (definition.Data.Execution.ExecutionType == ActionExecutionType.NodeJS) { var nodeAction = definition.Data.Execution as NodeJSActionExecutionData; + Trace.Info($"Action init node.js file: {nodeAction.Init ?? "N/A"}."); Trace.Info($"Action node.js file: {nodeAction.Script}."); Trace.Info($"Action cleanup node.js file: {nodeAction.Cleanup ?? "N/A"}."); } diff --git a/src/Test/L0/Worker/ActionManagerL0.cs b/src/Test/L0/Worker/ActionManagerL0.cs index 317259e22..479ff8b81 100644 --- a/src/Test/L0/Worker/ActionManagerL0.cs +++ b/src/Test/L0/Worker/ActionManagerL0.cs @@ -629,6 +629,88 @@ namespace GitHub.Runner.Common.Tests.Worker } } + [Fact] + [Trait("Level", "L0")] + [Trait("Category", "Worker")] + public async void PrepareActions_RepositoryActionWithInvalidWrapperActionfile_Node() + { + try + { + //Arrange + Setup(); + var actionId = Guid.NewGuid(); + var actions = new List + { + new Pipelines.ActionStep() + { + Name = "action", + Id = actionId, + Reference = new Pipelines.RepositoryPathReference() + { + Name = "TingluoHuang/runner_L0", + Ref = "RepositoryActionWithInvalidWrapperActionfile_Node", + RepositoryType = "GitHub" + } + } + }; + + //Act + try + { + await _actionManager.PrepareActionsAsync(_ec.Object, actions); + } + catch (NotSupportedException e) + { + Assert.Contains("`pre` or `main` is required for an actions.", e.Message); + } + } + finally + { + Teardown(); + } + } + + [Fact] + [Trait("Level", "L0")] + [Trait("Category", "Worker")] + public async void PrepareActions_RepositoryActionWithInvalidWrapperActionfile_Docker() + { + try + { + //Arrange + Setup(); + var actionId = Guid.NewGuid(); + var actions = new List + { + new Pipelines.ActionStep() + { + Name = "action", + Id = actionId, + Reference = new Pipelines.RepositoryPathReference() + { + Name = "TingluoHuang/runner_L0", + Ref = "RepositoryActionWithInvalidWrapperActionfile_Docker", + RepositoryType = "GitHub" + } + } + }; + + //Act + try + { + await _actionManager.PrepareActionsAsync(_ec.Object, actions); + } + catch (NotSupportedException e) + { + Assert.Contains("`pre` or `main` is required for an actions.", e.Message); + } + } + finally + { + Teardown(); + } + } + [Fact] [Trait("Level", "L0")] [Trait("Category", "Worker")]