Exit on success #26885
-
Hi, I am interested if there is an option to exit the workflow prematurely after a successful step. Is there another status code that can be used for these cases? For example, if I explicitly return with
|
Beta Was this translation helpful? Give feedback.
Replies: 4 comments
-
We have no methods to skip the subsequent steps without using the if conditional. In a job, by default only when a step is failure, the subsequent steps will be automatically skipped. Every step in the job will be implicitly added the if statement with the success status (if: ${{ success() }}) by default. Examples:
|
Beta Was this translation helpful? Give feedback.
-
Thank you for the explanation. After testing this I came to the same conclusion. Nevertheless, is there a plan for this to change? Because this way, if you have 15 steps afterwards, there is a lot of boilerplate included just for this condition to be fulfilled. Also, it is kind of weird to have support for failure exit code (i.e |
Beta Was this translation helpful? Give feedback.
-
Essentially, it is not that the failed step directly terminate the job or the workflow run. It just follows the implicit statement “if: ${{ success() }}” to orderly skip all the subsequent steps to make the job completed. This is consistent with what I mentioned above.
I do not find any plan about this. In addition, you also can follow the “GitHub public roadmap” repository where you can learn about what features the appropriate engineering teams are working on, what stage the features are in, and when the teams expect to bring them to you. |
Beta Was this translation helpful? Give feedback.
-
Thank you a lot for the detailed explanation. 👍 🤘 |
Beta Was this translation helpful? Give feedback.
@ivanovaleksandar ,
We have no methods to skip the subsequent steps without using the if conditional.
The if conditional is the designed and only way that used to skip jobs or steps in the workflow.
In a job, by default only when a step is failure, the subsequent steps will be automatically skipped. Every step in the job will be implicitly added the if statement with the success status (if: ${{ success() }}) by default.
If you want to skip the subsequent steps when the previous step is success, you must use the explicit if conditional with other statuses to override the default status, or combin…