Defer evaluation of a step's DislayName until its condition is evaluated.
Proposed fix for https://github.com/actions/runner/issues/2309
This fix relocates the logic for expanding a step's display name.
In the previous implementation, the display name was evaluated as part of step execution. It was therefore possible for display names to remain unevaluated for steps that ended up being skipped.
With this change, we now evaluate the display name right before we evaluate the step's condition.
In this way, the display name gets updated even if the condition check results in the step being skipped.
Before

After

Congrats on one of your very first PRs as part of the runtime team 👏 Very clear issue descriptions also 👏 👏 👏 Would it be possible to extract your implementation to a separate method and add some unit tests for it?
Congrats on one of your very first PRs as part of the runtime team 👏 Very clear issue descriptions also 👏 👏 👏 Would it be possible to extract your implementation to a separate method and add some unit tests for it?
Thanks! I spent a couple hours trying to devise a unit test for this given our unit testing framework and had to give up. Thomas and I both looked at it. As best as I can tell, there's no great way in our unit testing framework to exercise this code path without extensive mocking -- that is, mocking to the point where you're not really proving anything meaningful.
Fix verification with latest changes:
