mirror of
https://github.com/actions/runner.git
synced 2025-12-10 20:36:49 +00:00
c
This commit is contained in:
@@ -139,10 +139,6 @@ namespace GitHub.Runner.Worker
|
|||||||
|
|
||||||
preStepTracker[action.Id] = actionRunner;
|
preStepTracker[action.Id] = actionRunner;
|
||||||
}
|
}
|
||||||
else if (!definition.Data.Execution.HasMain && definition.Data.Execution.HasCleanup)
|
|
||||||
{
|
|
||||||
throw new NotSupportedException($"Action {repoAction.Name}@{repoAction.Ref} only has `post` execution, `pre` or `main` is required for an actions.");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -82,6 +82,13 @@ namespace GitHub.Runner.Worker
|
|||||||
ActionExecutionData handlerData = definition.Data?.Execution;
|
ActionExecutionData handlerData = definition.Data?.Execution;
|
||||||
ArgUtil.NotNull(handlerData, nameof(handlerData));
|
ArgUtil.NotNull(handlerData, nameof(handlerData));
|
||||||
|
|
||||||
|
if (handlerData.HasInit &&
|
||||||
|
Action.Reference is Pipelines.RepositoryPathReference repoAction &&
|
||||||
|
string.Equals(repoAction.RepositoryType, Pipelines.PipelineConstants.SelfAlias, StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
ExecutionContext.Warning($"`pre` execution is not supported for local action from '{repoAction.Path}'");
|
||||||
|
}
|
||||||
|
|
||||||
// The action has post cleanup defined.
|
// The action has post cleanup defined.
|
||||||
// we need to create timeline record for them and add them to the step list that StepRunner is using
|
// we need to create timeline record for them and add them to the step list that StepRunner is using
|
||||||
if (handlerData.HasCleanup && (Stage == ActionRunStage.Pre || Stage == ActionRunStage.Main))
|
if (handlerData.HasCleanup && (Stage == ActionRunStage.Pre || Stage == ActionRunStage.Main))
|
||||||
|
|||||||
@@ -659,50 +659,9 @@ namespace GitHub.Runner.Common.Tests.Worker
|
|||||||
{
|
{
|
||||||
await _actionManager.PrepareActionsAsync(_ec.Object, actions);
|
await _actionManager.PrepareActionsAsync(_ec.Object, actions);
|
||||||
}
|
}
|
||||||
catch (NotSupportedException e)
|
catch (ArgumentNullException e)
|
||||||
{
|
{
|
||||||
Assert.Contains("`pre` or `main` is required for an actions.", e.Message);
|
Assert.Contains("Entry javascript fils is not provided.", 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<Pipelines.ActionStep>
|
|
||||||
{
|
|
||||||
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
|
finally
|
||||||
|
|||||||
Reference in New Issue
Block a user