runner icon indicating copy to clipboard operation
runner copied to clipboard

Defer evaluation of a step's DislayName until its condition is evaluated.

Open jww3 opened this issue 3 years ago • 2 comments

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

image

After

image

jww3 avatar Dec 13 '22 18:12 jww3

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?

AvaStancu avatar Dec 15 '22 09:12 AvaStancu

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.

jww3 avatar Dec 16 '22 10:12 jww3

Fix verification with latest changes:

image

jww3 avatar Feb 06 '23 13:02 jww3