diff --git a/gitea-ci/webhook.go b/gitea-ci/webhook.go index 4ba4d09..0dde14c 100644 --- a/gitea-ci/webhook.go +++ b/gitea-ci/webhook.go @@ -5,6 +5,8 @@ import ( "crypto/sha256" "encoding/hex" "encoding/json" + "errors" + "fmt" "io" "log" "net/http" @@ -219,6 +221,12 @@ func (h webhook) ServeHTTP(w http.ResponseWriter, req *http.Request) { if err != nil { log.Println("runner.Run", err) state = "failure" + + if unwrapped := errors.Unwrap(err); unwrapped != nil { + if ee, ok := err.(*exec.ExitError); ok { + fmt.Fprintf(run, "\n######### Failed with error code %d", ee.ProcessState.ExitCode()) + } + } } err = h.gitea.CreateCommitStatus(hook.Repository.FullName, hook.AfterCommit, gitea.CommitStatus{ Context: "repro-run",