Wandalen / wretry.action

Retry action for Github CI
MIT License
93 stars 20 forks source link

Conditional retry? #123

Closed mikeage closed 4 months ago

mikeage commented 9 months ago

Hi,

Is it possible to use this to conditionally retry an action? I have a step that sometimes fails for a reason that should be retried, but other times, I don't want to retry it. The decision is based on the value of an output from that step. Is this possible?

dmvict commented 9 months ago

Hello @mikeage

The action has no such functionality. It retries only failed (non zero exit code) actions. I'm not sure that it is easy to add to the action.

mikeage commented 9 months ago

Thanks. If at any point you add such a feature, I'd be very appreciative, but I know it's not trivial to find a good way to evaluate this.

dmvict commented 5 months ago

Hello @mikeage

I have implemented the requested feature, which I believe addresses the functionality you inquired about in the past. It is retry_condition option. Although I am confident it will function well with the outputs from previous steps, I cannot guarantee the same for the current step's output. I kindly request that you test the v3.1.0 action and provide feedback on your experience, particularly focusing on the outputs produced. For more information about the action outputs, please refer to the documentation at https://github.com/Wandalen/wretry.action?tab=readme-ov-file#outputs.

mikeage commented 5 months ago

Thank you. I'll try it shortly and let you know how it works. I'm also not positive it'll work with the current step, which is what I need, but we'll find out :-)

mikeage commented 5 months ago

Unfortunately, it tries to evaluate the output at the time when it calls the action, so it doesn't help when the decision is based on the actions output itself.

Reading a bit more about how github handles outputs, I'm not quite sure how it could be implemented. Perhaps I could pass a string to search for... but I feel like that would very quickly get too specific and not flexible enough.

dmvict commented 5 months ago

Hello @mikeage

I suppose that you'd used expression tokens ${{ }}. It says that Github runner should evaluate expression before call. Please, try to skip them.

I don't have much time to test and make working the case with output of current step.

mikeage commented 5 months ago

You are correct about the ${{ ... }}; without it, it's just a string.

I know that the current step's output is not trivial, and I understand if this action can't support it. If I had an idea how to do it, I'd submit a PR, but I don't have any ideas myself. Thanks for looking into it.

dmvict commented 4 months ago

Hello @mikeage

I've added required feature. Please, use syntax from section retry_condition to declare your condition. It is important to skip braces.

I'm closing the issue because I tested it manually with a test action.

mikeage commented 3 months ago

Thank you very much! I'm testing it in https://github.com/icosa-foundation/open-brush/pull/716, but it looks promising.

mikeage commented 3 months ago

Just wanted to let you know that this works perfectly. Thank you very much!