mirror of
https://github.com/actions/runner.git
synced 2025-12-14 13:43:33 +00:00
Set github action path before and after composite action
This commit is contained in:
@@ -98,7 +98,7 @@ namespace GitHub.Runner.Worker
|
|||||||
// others
|
// others
|
||||||
void ForceTaskComplete();
|
void ForceTaskComplete();
|
||||||
void RegisterPostJobStep(IStep step);
|
void RegisterPostJobStep(IStep step);
|
||||||
IStep CreateCompositeStep(string scopeName, IActionRunner step, DictionaryContextData inputsData, Dictionary<string, string> envData, string actionDirectory);
|
IStep CreateCompositeStep(string scopeName, IActionRunner step, DictionaryContextData inputsData, Dictionary<string, string> envData);
|
||||||
}
|
}
|
||||||
|
|
||||||
public sealed class ExecutionContext : RunnerService, IExecutionContext
|
public sealed class ExecutionContext : RunnerService, IExecutionContext
|
||||||
@@ -258,8 +258,7 @@ namespace GitHub.Runner.Worker
|
|||||||
string scopeName,
|
string scopeName,
|
||||||
IActionRunner step,
|
IActionRunner step,
|
||||||
DictionaryContextData inputsData,
|
DictionaryContextData inputsData,
|
||||||
Dictionary<string, string> envData,
|
Dictionary<string, string> envData)
|
||||||
string actionDirectory)
|
|
||||||
{
|
{
|
||||||
step.ExecutionContext = Root.CreateChild(_record.Id, step.DisplayName, _record.Id.ToString("N"), scopeName, step.Action.ContextName, logger: _logger, insideComposite: true, cancellationTokenSource: CancellationTokenSource.CreateLinkedTokenSource(_cancellationTokenSource.Token));
|
step.ExecutionContext = Root.CreateChild(_record.Id, step.DisplayName, _record.Id.ToString("N"), scopeName, step.Action.ContextName, logger: _logger, insideComposite: true, cancellationTokenSource: CancellationTokenSource.CreateLinkedTokenSource(_cancellationTokenSource.Token));
|
||||||
step.ExecutionContext.ExpressionValues["inputs"] = inputsData;
|
step.ExecutionContext.ExpressionValues["inputs"] = inputsData;
|
||||||
@@ -277,9 +276,6 @@ namespace GitHub.Runner.Worker
|
|||||||
}
|
}
|
||||||
step.ExecutionContext.ExpressionValues["env"] = envContext;
|
step.ExecutionContext.ExpressionValues["env"] = envContext;
|
||||||
|
|
||||||
// Set GITHUB_ACTION_PATH for each step
|
|
||||||
step.ExecutionContext.SetGitHubContext("action_path", actionDirectory);
|
|
||||||
|
|
||||||
return step;
|
return step;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -56,6 +56,9 @@ namespace GitHub.Runner.Worker.Handlers
|
|||||||
childScopeName = $"__{Guid.NewGuid()}";
|
childScopeName = $"__{Guid.NewGuid()}";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Add GITHUB_ACTION_PATH
|
||||||
|
ExecutionContext.SetGitHubContext("action_path", ActionDirectory);
|
||||||
|
|
||||||
foreach (Pipelines.ActionStep actionStep in actionSteps)
|
foreach (Pipelines.ActionStep actionStep in actionSteps)
|
||||||
{
|
{
|
||||||
var actionRunner = HostContext.CreateService<IActionRunner>();
|
var actionRunner = HostContext.CreateService<IActionRunner>();
|
||||||
@@ -63,7 +66,7 @@ namespace GitHub.Runner.Worker.Handlers
|
|||||||
actionRunner.Stage = stage;
|
actionRunner.Stage = stage;
|
||||||
actionRunner.Condition = actionStep.Condition;
|
actionRunner.Condition = actionStep.Condition;
|
||||||
|
|
||||||
var step = ExecutionContext.CreateCompositeStep(childScopeName, actionRunner, inputsData, Environment, ActionDirectory);
|
var step = ExecutionContext.CreateCompositeStep(childScopeName, actionRunner, inputsData, Environment);
|
||||||
compositeSteps.Add(step);
|
compositeSteps.Add(step);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -85,6 +88,9 @@ namespace GitHub.Runner.Worker.Handlers
|
|||||||
ExecutionContext.Error(ex);
|
ExecutionContext.Error(ex);
|
||||||
ExecutionContext.Result = TaskResult.Failed;
|
ExecutionContext.Result = TaskResult.Failed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Remove GITHUB_ACTION_PATH
|
||||||
|
ExecutionContext.SetGitHubContext("action_path", "");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ProcessCompositeActionOutputs()
|
private void ProcessCompositeActionOutputs()
|
||||||
|
|||||||
Reference in New Issue
Block a user