mirror of
https://github.com/actions/runner.git
synced 2025-12-17 15:59:37 +00:00
Set github action path at step level instead of global scope to avoid necessary removal
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);
|
IStep CreateCompositeStep(string scopeName, IActionRunner step, DictionaryContextData inputsData, Dictionary<string, string> envData, string actionDirectory);
|
||||||
}
|
}
|
||||||
|
|
||||||
public sealed class ExecutionContext : RunnerService, IExecutionContext
|
public sealed class ExecutionContext : RunnerService, IExecutionContext
|
||||||
@@ -258,7 +258,8 @@ 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;
|
||||||
@@ -276,6 +277,9 @@ 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,9 +56,6 @@ namespace GitHub.Runner.Worker.Handlers
|
|||||||
childScopeName = $"__{Guid.NewGuid()}";
|
childScopeName = $"__{Guid.NewGuid()}";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set 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>();
|
||||||
@@ -66,7 +63,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);
|
var step = ExecutionContext.CreateCompositeStep(childScopeName, actionRunner, inputsData, Environment, ActionDirectory);
|
||||||
compositeSteps.Add(step);
|
compositeSteps.Add(step);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user