chore: bump sdk to v1.5.0

This commit is contained in:
Louis Seubert 2026-09-13 18:57:17 +02:00
commit 5a37d05e67
Signed by: louis9902
GPG key ID: 4B9DB28F826553BD

View file

@ -6,11 +6,11 @@ import (
"encoding/json"
"fmt"
"io"
"mime"
"mime/multipart"
"net/http"
"os"
"strings"
"code.geekeey.de/actions/sdk"
)
type ApiClient interface {
@ -43,24 +43,6 @@ func NewGitHub(client ApiClient) *GitHub {
return &GitHub{client: client}
}
func HasContentType(r *http.Response, mimetype string) bool {
contentType := r.Header.Get("content-type")
if contentType == "" {
return mimetype == "application/octet-stream"
}
for _, v := range strings.Split(contentType, ",") {
t, _, err := mime.ParseMediaType(v)
if err != nil {
break
}
if t == mimetype {
return true
}
}
return false
}
type GitTag struct {
Commit struct {
Created string `json:"created,omitempty"`
@ -87,7 +69,7 @@ func (gh *GitHub) GetGitTagInfo(repository, tag string, ctx context.Context) (*G
return nil, err
}
defer res.Body.Close()
if !HasContentType(res, "application/json") {
if !sdk.HasContentType(res, "application/json") {
return nil, fmt.Errorf("content-type: %q should be %q",
res.Header.Get("content-type"), "application/json")
}
@ -161,7 +143,7 @@ func (gh *GitHub) CreateRelease(creq *CreateReleaseRequest, ctx context.Context)
return nil, err
}
defer res.Body.Close()
if !HasContentType(res, "application/json") {
if !sdk.HasContentType(res, "application/json") {
return nil, fmt.Errorf("content-type: %q should be %q",
res.Header.Get("content-type"), "application/json")
}
@ -264,7 +246,7 @@ func (gh *GitHub) CreateReleaseArtifact(creq *CreateReleaseArtifactRequest, ctx
return nil, err
}
defer res.Body.Close()
if !HasContentType(res, "application/json") {
if !sdk.HasContentType(res, "application/json") {
return nil, fmt.Errorf("content-type: %q should be %q",
res.Header.Get("content-type"), "application/json")
}