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

Exit Code 0 even if Hooks plugin failed #138

Closed
AndreasSko opened this issue May 2, 2022 · 2 comments
Closed

Exit Code 0 even if Hooks plugin failed #138

AndreasSko opened this issue May 2, 2022 · 2 comments

Comments

@AndreasSko
Copy link
Contributor

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

herr := hooksExecutor.Success(&hooks.SuccessHookConfig{
Commits: commits,
PrevRelease: release,
NewRelease: &semrel.Release{
SHA: currentSha,
Version: newVer,
},
Changelog: changelogRes,
RepoInfo: repoInfo,
})
if herr != nil {
logger.Printf("there was an error executing the hooks plugins: %s", herr.Error())
}

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 🙂

@christophwitzko
Copy link
Member

christophwitzko commented May 22, 2022

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
Copy link
Contributor Author

Thank you, @christophwitzko! Really appreciate it 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants