Fail build when post-receive hook fails

I’m pushing result of the build to the private repo and running some post-deployment steps via post-receive hook. Is there a way to let build fail, when this script fails?

I can imagine pushing back to Github if everything went fine and starting a new workflow run that way, but that seems to be wasteful…

Another way could probably be setting up some value, which could be fetched using HTTP request made from the GA build. This seems to be too complicated as well.

@miloskroulik,

If the build job in a workflow run has completed, we have no any available method to changed the status of the job.

Maybe you can try re-running the workflow. You can try to add some steps in the workflow to monitor the result of the script in the post-deployment steps. When re-running the the workflow, if the script fails, let the build fails.

Thanks. It seems to me that https://docs.github.com/en/free-pro-team@latest/rest/reference/repos#create-a-repository-dispatch-event is the way to go if I want to start another workflow only if post-receive script ended successfully. It’s shame that there’s now way to set status of workflow run through the API.