Defer evaluation of a step's DisplayName until its condition is evaluated. (#2313)

* Defer evaluation of a step's DisplayName until its condition is evaluated.
* Formalize TryUpdateDisplayName and EvaluateDisplayName as members of interface `IStep` (#2374)
This commit is contained in:
John Wesley Walker III
2023-02-07 11:42:30 +01:00
committed by GitHub
parent 3cd76671dd
commit 9a228e52e9
5 changed files with 128 additions and 42 deletions

View File

@@ -1,6 +1,7 @@
using System;
using System.Threading.Tasks;
using GitHub.DistributedTask.ObjectTemplating.Tokens;
using GitHub.DistributedTask.Pipelines.ContextData;
namespace GitHub.Runner.Worker
{
@@ -32,5 +33,18 @@ namespace GitHub.Runner.Worker
{
await _runAsync(ExecutionContext, _data);
}
public bool TryUpdateDisplayName(out bool updated)
{
updated = false;
return !string.IsNullOrEmpty(this.DisplayName);
}
public bool EvaluateDisplayName(DictionaryContextData contextData, IExecutionContext context, out bool updated)
{
updated = false;
return !string.IsNullOrEmpty(this.DisplayName);
}
}
}