Upgrade core-go
This commit is contained in:
parent
adc6fbc160
commit
3f02d409c2
|
@ -20,7 +20,6 @@ import (
|
|||
"github.com/google/shlex"
|
||||
_ "github.com/lib/pq"
|
||||
"github.com/vaughan0/go-ini"
|
||||
"github.com/vektah/gqlparser/v2/gqlerror"
|
||||
)
|
||||
|
||||
const (
|
||||
|
@ -282,27 +281,18 @@ func main() {
|
|||
},
|
||||
}
|
||||
resp := struct {
|
||||
Data struct {
|
||||
CreateRepository struct {
|
||||
ID int `json:"id"`
|
||||
} `json:"createRepository"`
|
||||
} `json:"data"`
|
||||
Errors []gqlerror.Error `json:"errors"`
|
||||
CreateRepository struct {
|
||||
ID int `json:"id"`
|
||||
} `json:"createRepository"`
|
||||
}{}
|
||||
|
||||
crypto.InitCrypto(config)
|
||||
ctx := coreconfig.Context(context.Background(), config, "git.sr.ht")
|
||||
err := client.Execute(ctx, pusherName, "git.sr.ht", query, &resp)
|
||||
err := client.Do(ctx, pusherName, "git.sr.ht", query, &resp)
|
||||
if err != nil {
|
||||
notFound("create repository", err)
|
||||
} else if len(resp.Errors) > 0 {
|
||||
errs := []error{}
|
||||
for i := range resp.Errors {
|
||||
errs = append(errs, &resp.Errors[i])
|
||||
}
|
||||
notFound("create repository", errs...)
|
||||
}
|
||||
repoId = resp.Data.CreateRepository.ID
|
||||
repoId = resp.CreateRepository.ID
|
||||
autocreated = true
|
||||
logger.Printf("Autocreated repo %s", path)
|
||||
}
|
||||
|
|
|
@ -20,7 +20,6 @@ import (
|
|||
"github.com/go-git/go-git/v5/plumbing/storer"
|
||||
goredis "github.com/go-redis/redis/v8"
|
||||
_ "github.com/lib/pq"
|
||||
"github.com/vektah/gqlparser/v2/gqlerror"
|
||||
)
|
||||
|
||||
func printAutocreateInfo(context PushContext) {
|
||||
|
@ -58,17 +57,12 @@ func fetchInfoForPush(db *sql.DB, username string, repoId int, repoName string,
|
|||
Visibility *string `json:"visibility,omitempty"`
|
||||
}
|
||||
|
||||
type Response struct {
|
||||
Errors []gqlerror.Error `json:"errors"`
|
||||
}
|
||||
|
||||
input := RepoInput{newDescription, newVisibility}
|
||||
resp := Response{}
|
||||
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
|
||||
defer cancel()
|
||||
ctx = coreconfig.Context(ctx, config, "git.sr.ht")
|
||||
err := client.Execute(ctx, username, "git.sr.ht", client.GraphQLQuery{
|
||||
err := client.Do(ctx, username, "git.sr.ht", client.GraphQLQuery{
|
||||
Query: `
|
||||
mutation UpdateRepository($id: Int!, $input: RepoInput!) {
|
||||
updateRepository(id: $id, input: $input) { id }
|
||||
|
@ -77,14 +71,10 @@ func fetchInfoForPush(db *sql.DB, username string, repoId int, repoName string,
|
|||
"id": repoId,
|
||||
"input": input,
|
||||
},
|
||||
}, &resp)
|
||||
}, struct{}{})
|
||||
if err != nil {
|
||||
return dbinfo, err
|
||||
} else if len(resp.Errors) > 0 {
|
||||
for _, err := range resp.Errors {
|
||||
logger.Printf("Error updating repository: %s", err.Error())
|
||||
}
|
||||
return dbinfo, fmt.Errorf("Failed to update repository: %s", resp.Errors[0].Message)
|
||||
logger.Printf("Error updating repository: %v", err)
|
||||
return dbinfo, fmt.Errorf("failed to update repository: %v", err)
|
||||
}
|
||||
|
||||
if newVisibility != nil {
|
||||
|
|
|
@ -20,7 +20,6 @@ import (
|
|||
"github.com/go-git/go-git/v5/plumbing/filemode"
|
||||
"github.com/go-git/go-git/v5/plumbing/object"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/vektah/gqlparser/v2/gqlerror"
|
||||
)
|
||||
|
||||
var (
|
||||
|
@ -312,23 +311,16 @@ func SubmitBuild(ctx context.Context, submitter *GitBuildSubmitter) ([]BuildSubm
|
|||
},
|
||||
}
|
||||
|
||||
resp := struct {
|
||||
Data struct {
|
||||
Submit struct {
|
||||
ID int `json:"id"`
|
||||
} `json:"submit"`
|
||||
} `json:"data"`
|
||||
Errors gqlerror.List `json:"errors"`
|
||||
}{}
|
||||
var resp struct {
|
||||
Submit struct {
|
||||
ID int `json:"id"`
|
||||
} `json:"submit"`
|
||||
}
|
||||
|
||||
err = client.Execute(ctx, submitter.PusherName, "builds.sr.ht", query, &resp)
|
||||
err = client.Do(ctx, submitter.PusherName, "builds.sr.ht", query, &resp)
|
||||
if err != nil {
|
||||
logger.Printf("Error submitting build: %v", err)
|
||||
return nil, err
|
||||
} else if len(resp.Errors) > 0 {
|
||||
for _, err := range resp.Errors {
|
||||
logger.Printf("Error submitting build: %s", err.Error())
|
||||
}
|
||||
return nil, fmt.Errorf("%s", resp.Errors[0].Message)
|
||||
}
|
||||
|
||||
results = append(results, BuildSubmission{
|
||||
|
@ -336,7 +328,7 @@ func SubmitBuild(ctx context.Context, submitter *GitBuildSubmitter) ([]BuildSubm
|
|||
Url: fmt.Sprintf("%s/~%s/job/%d",
|
||||
submitter.BuildOrigin,
|
||||
submitter.PusherName,
|
||||
resp.Data.Submit.ID),
|
||||
resp.Submit.ID),
|
||||
})
|
||||
}
|
||||
|
||||
|
|
2
go.mod
2
go.mod
|
@ -3,7 +3,7 @@ module git.sr.ht/~sircmpwn/git.sr.ht
|
|||
go 1.16
|
||||
|
||||
require (
|
||||
git.sr.ht/~sircmpwn/core-go v0.0.0-20240109104919-453dcaefd647
|
||||
git.sr.ht/~sircmpwn/core-go v0.0.0-20240124105042-864816cfbc0c
|
||||
git.sr.ht/~sircmpwn/dowork v0.0.0-20221010085743-46c4299d76a1
|
||||
git.sr.ht/~sircmpwn/scm.sr.ht/srht-keys v0.0.0-20230322101108-c39456ffb47d
|
||||
git.sr.ht/~turminal/go-fnmatch v0.0.0-20211021204744-1a55764af6de
|
||||
|
|
4
go.sum
4
go.sum
|
@ -598,8 +598,8 @@ dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7
|
|||
gioui.org v0.0.0-20210308172011-57750fc8a0a6/go.mod h1:RSH6KIUZ0p2xy5zHDxgAM4zumjgTw83q2ge/PI+yyw8=
|
||||
git.sr.ht/~sbinet/gg v0.3.1/go.mod h1:KGYtlADtqsqANL9ueOFkWymvzUvLMQllU5Ixo+8v3pc=
|
||||
git.sr.ht/~sircmpwn/core-go v0.0.0-20201005173246-a9e49d17a1e6/go.mod h1:HpPX22ilJUWKOA4NDhrOcIyblQhdiKHPg4oMJFYdh0Y=
|
||||
git.sr.ht/~sircmpwn/core-go v0.0.0-20240109104919-453dcaefd647 h1:exqOwBLkH3ZzYBL4PbMNx/SWyXA6VscuYk3x8Wedr1E=
|
||||
git.sr.ht/~sircmpwn/core-go v0.0.0-20240109104919-453dcaefd647/go.mod h1:OovCpg5LsbYJjmDTpk5wUgHM4tUor736Pmxekm9BUcQ=
|
||||
git.sr.ht/~sircmpwn/core-go v0.0.0-20240124105042-864816cfbc0c h1:o5jKIK7BJBEGSuY9ux4FREZry4aJV3DgI41iP6uf5xY=
|
||||
git.sr.ht/~sircmpwn/core-go v0.0.0-20240124105042-864816cfbc0c/go.mod h1:OovCpg5LsbYJjmDTpk5wUgHM4tUor736Pmxekm9BUcQ=
|
||||
git.sr.ht/~sircmpwn/dowork v0.0.0-20221010085743-46c4299d76a1 h1:EvPKkneKkF/f7zEgKPqIZVyj3jWO8zSmsBOvMhAGqMA=
|
||||
git.sr.ht/~sircmpwn/dowork v0.0.0-20221010085743-46c4299d76a1/go.mod h1:8neHEO3503w/rNtttnR0JFpQgM/GFhaafVwvkPsFIDw=
|
||||
git.sr.ht/~sircmpwn/getopt v0.0.0-20191230200459-23622cc906b3/go.mod h1:wMEGFFFNuPos7vHmWXfszqImLppbc0wEhh6JBfJIUgw=
|
||||
|
|
Loading…
Reference in New Issue