Skip to content

Provide conditional task helpers (always, failure, ...) #164

Open
@mjnagel

Description

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 succeed
  • if ${{ 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 in wait actions and chaining together multiple discreet tasks.

Tasks

Preview Give feedback
No tasks being tracked yet.

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions