go-semantic-release / semantic-release

📦🚀 semantic-release written in Go
https://go-semantic-release.xyz
MIT License
395 stars 43 forks source link

Exit Code 0 even if Hooks plugin failed #138

Closed AndreasSko closed 2 years ago

AndreasSko commented 2 years ago

While developing a custom Hooks plugin I noticed that semantic-release will exit successfully, even if the Hooks plugin returned an error. I'm wondering if this is expected behavior or a bug. I think https://github.com/go-semantic-release/semantic-release/blob/18e8bae821ffac4f4569bc642ae3cb29ecf983f6/cmd/semantic-release/main.go#L308-L321 is missing an exitIfError, which is the case for other plugin calls (like Init).

I'm happy to open a PR if this is something that is ok to be changed :slightly_smiling_face:

christophwitzko commented 2 years ago

Hi @AndreasSko, the idea was that hooks plugins should never interrupt the release flow. But I can see cases where this makes sense. ~We can put it behind a cli flag, so users have to explicitly enable it.~

Update: I was also just working with a hooks plugin and if the success hook fails, semantic-release should definitely return a non-zero exit code. Thanks for raising this issue, it should be fixed with the next release. 🙏

AndreasSko commented 2 years ago

Thank you, @christophwitzko! Really appreciate it :slightly_smiling_face: