nuke
nuke copied to clipboard
OnlyWhenX: add skip reason
Description
If a step is skipped due to a skipping reason, the SkipReason in the command line output is semantically wrong. But when configuring the build target it is semantically correct.
Example:
Target PushStable => _ => _
.DependsOn(Pack)
.OnlyWhenDynamic(() => IsNoPrerelease)
.Executes(() => {});
Output: PushStable Skipped // SkipReason: IsNoPrerelease <--- this should be called IsPrerelease (because of that reason this is skipped)
Usage Example
Target PushStable => _ => _
.DependsOn(Pack)
.OnlyWhenDynamic("Because it is a prerelease", () => IsNoPrerelease)
.Executes(() => {});
Output:
PushStable Skipped // SkipReason: Because it is a prerelease
Alternative
No response
An alternative would be to add a new method: SkipWhen
which does the opposite of OnlyWhen
.
I just had the same confusion reading the output.
My inital feeling was we could just rename "SkipReason: " to "OnlyIf:", or "OnlyWhen:"
That way at least the sense (and semantics) of the message would be correct.
PushStable Skipped // OnlyIf: IsNoPrerelease
Thanks :) Looking forward to 6.3.0 🎉🎉