nurse/magefiles/reporting.go
Peter 59d2d26984
All checks were successful
concourse-ci/golangci-lint golangci-lint run
concourse-ci/gotestsum gotestsum
feat: add concourse pipeline
2022-12-30 21:41:30 +01:00

38 lines
658 B
Go

package main
import (
"context"
"fmt"
"net/http"
"code.gitea.io/sdk/gitea"
)
type CommitState string
func (s CommitState) String() string {
return string(s)
}
func setCommitStatus(ctx context.Context, notification gitea.CreateStatusOption) error {
if GiteaClient == nil {
return nil
}
GiteaClient.SetContext(ctx)
_, resp, err := GiteaClient.CreateStatus("inetmock", "inetmock", GitCommit, notification)
if err != nil {
return err
}
defer func() {
_ = resp.Close
}()
if resp.StatusCode >= http.StatusMultipleChoices {
return fmt.Errorf("failed to update commit status - %d - %s", resp.StatusCode, resp.Status)
}
return nil
}