Provide conditional task helpers (always
, failure
, ...)
#164
Labels
enhancement ✨
New feature or request
always
, failure
, ...)
#164
Is your feature request related to a problem? Please describe
When running tasks it is often useful to conditionally run a given action on a hook/based on the status of other actions run. A specific use case would be running a test and conditionally running some debug output on failure, or always running some cleanup tasks to remove test resources.
Describe the solution you'd like
I think a few specific helpers would be useful to start. These suggestions are based on GitHub's status check functions, but could be changed to whatever, the behavior is the important part:
if: ${{ always() }}
: Runs regardless of previous task/action success or failure (useful for cleanup type tasks)if: ${{ failure() }}
: Runs on failure of previous task/actions, does not affect resulting status code of maru (useful for debug output on a failed action)if ${{ success }}
: Not sure I see a real use case for this, given it's the default behavior, but this would run when all previous tasks succeedif ${{ cancelled() }}
Would run when tasks are cancelled (i.e.ctrl-c
or otherwise). This is probably a larger effort than the other two, but could be useful in some cases for things like cleanup on cancellation.Describe alternatives you've considered
Most of this type of logic could be implemented with shell scripts, run via
cmd
, but that reduces some options for using built inwait
actions and chaining together multiple discreet tasks.Tasks
The text was updated successfully, but these errors were encountered: