feat: retry only on specific exit code#58
Conversation
809a10b to
679f4bb
Compare
| expected: 3 | ||
| actual: ${{ steps.retry_on_exit_code_expected.outputs.total_attempts }} | ||
|
|
||
| - name: retry_on_exit_code (with unexpected error code) |
There was a problem hiding this comment.
Can you take a look at this test failure? I made a few tweaks to your tests, first being that a duplicate id was used which caused the entire workflow to fail, then I added assertions to your two tests.
The assertion is failing for your retry_on_exit_code (with unexpected error code) test. I assert that if an unexpected exit code is thrown (exit code 1), and the retry_on_exit_code is set (exit code 2), then the rerun should only occur once not 3x as is happening currently. I think you need to also handle max_attempts when retry_on_exit_code is set and skip additional attempts if an unexpected exit code is returned.
There was a problem hiding this comment.
Hey @nick-fields , well danged, I've poked gently asked @andersfischernielsen to have a look at this!
|
@nick-fields Sorry about the duped IDs 😬 I’m pretty sure (take this with a grain of salt due to tired brain) that moving the check for the specific exit code to a separate In other words, what I'd change the implementation to is: As far as I understand the pre-existing code, this would allow us to blindly throw if a specific exit code is given _and_ we don't see that given exit code after the first failure, in turn leading to no retries. LMK if I'm misunderstanding the behaviour here 🙏🏼Great that moving the PR allows Actions to run, but I'm unable to contribute to this PR due to missing access rights. How would you like me to contribute a fix to the failing test? |
It was easier to just pull your proposed fix in and test it. Looks like it worked! Merging now, and thanks for the contribution. |
|
🎉 This PR is included in version 2.7.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |

I just pulled the changes from the forked PR #57 into a branch so that Actions and tests would run.