gitea-ci: printear código de error
All checks were successful
repro-run Corre repro-run.json

This commit is contained in:
Cat /dev/Nulo 2023-01-29 12:58:06 -03:00
parent da9bcb415e
commit e62ed3a4d3

View file

@ -5,6 +5,8 @@ import (
"crypto/sha256" "crypto/sha256"
"encoding/hex" "encoding/hex"
"encoding/json" "encoding/json"
"errors"
"fmt"
"io" "io"
"log" "log"
"net/http" "net/http"
@ -219,6 +221,12 @@ func (h webhook) ServeHTTP(w http.ResponseWriter, req *http.Request) {
if err != nil { if err != nil {
log.Println("runner.Run", err) log.Println("runner.Run", err)
state = "failure" 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{ err = h.gitea.CreateCommitStatus(hook.Repository.FullName, hook.AfterCommit, gitea.CommitStatus{
Context: "repro-run", Context: "repro-run",