Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
mjnagel opened this issue Oct 18, 2024 · 0 comments
Open

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

mjnagel opened this issue Oct 18, 2024 · 0 comments
Labels
enhancement ✨ New feature or request

Comments

@mjnagel
Copy link

mjnagel commented Oct 18, 2024

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.
@mjnagel mjnagel added the enhancement ✨ New feature or request label Oct 18, 2024
@mjnagel mjnagel changed the title Provide conditional task helpers (always, failure, success) Provide conditional task helpers (always, failure, ...) Oct 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement ✨ New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant