diff --git a/go.mod b/go.mod index 380aecd1cb5..78b79f7d699 100644 --- a/go.mod +++ b/go.mod @@ -47,7 +47,7 @@ replace ( ) require ( - code.gitea.io/sdk/gitea v0.16.0 + code.gitea.io/sdk/gitea v0.17.1 github.com/goccy/kpoward v0.1.0 github.com/google/cel-go v0.19.0 github.com/google/go-containerregistry/pkg/authn/k8schain v0.0.0-20230625233257-b8504803389b diff --git a/go.sum b/go.sum index f5bcb808d07..48c829a1d9c 100644 --- a/go.sum +++ b/go.sum @@ -47,8 +47,8 @@ cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0Zeo cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk= cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= -code.gitea.io/sdk/gitea v0.16.0 h1:gAfssETO1Hv9QbE+/nhWu7EjoFQYKt6kPoyDytQgw00= -code.gitea.io/sdk/gitea v0.16.0/go.mod h1:ndkDk99BnfiUCCYEUhpNzi0lpmApXlwRFqClBlOlEBg= +code.gitea.io/sdk/gitea v0.17.1 h1:3jCPOG2ojbl8AcfaUCRYLT5MUcBMFwS0OSK2mA5Zok8= +code.gitea.io/sdk/gitea v0.17.1/go.mod h1:aCnBqhHpoEWA180gMbaCtdX9Pl6BWBAuuP2miadoTNM= contrib.go.opencensus.io/exporter/ocagent v0.7.1-0.20200907061046-05415f1de66d h1:LblfooH1lKOpp1hIhukktmSAxFkqMPFk9KR6iZ0MJNI= contrib.go.opencensus.io/exporter/ocagent v0.7.1-0.20200907061046-05415f1de66d/go.mod h1:IshRmMJBhDfFj5Y67nVhMYTTIze91RUeT73ipWKs/GY= contrib.go.opencensus.io/exporter/prometheus v0.4.0 h1:0QfIkj9z/iVZgK31D9H9ohjjIDApI2GOPScCKwxedbs= @@ -700,7 +700,6 @@ github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdv github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= github.com/hashicorp/go-uuid v1.0.2/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= -github.com/hashicorp/go-version v1.5.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= github.com/hashicorp/go-version v1.6.0 h1:feTTfFNnjP967rlCxM/I9g701jU+RN74YKx2mOkIeek= github.com/hashicorp/go-version v1.6.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= github.com/hashicorp/go.net v0.0.1/go.mod h1:hjKkEWcCURg++eb33jQU7oqQcI9XDCnUzHA0oac0k90= @@ -1224,13 +1223,13 @@ golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a/go.mod h1:P+XmwS30IXTQdn5 golang.org/x/crypto v0.0.0-20210920023735-84f357641f63/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20211215153901-e495a2d5b3d3/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/crypto v0.0.0-20220525230936-793ad666bf5e/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw= golang.org/x/crypto v0.3.1-0.20221117191849-2c476679df9a/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4= golang.org/x/crypto v0.6.0/go.mod h1:OFC/31mSvZgRz0V1QTNCzfAI1aIRzbiufJtkMIlEp58= golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU= +golang.org/x/crypto v0.17.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4= golang.org/x/crypto v0.18.0 h1:PGVlW0xEltQnzFZ55hkuX5+KLyrMYhHld1YHO4AKcdc= golang.org/x/crypto v0.18.0/go.mod h1:R0j02AL6hcrfOiy9T4ZYp/rcWeMxM3L6QYxlOuEG1mg= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= @@ -1342,6 +1341,7 @@ golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco= golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= +golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= golang.org/x/net v0.20.0 h1:aCL9BSgETF1k+blQaYUBx9hJ9LOGP3gAVemcZlf1Kpo= golang.org/x/net v0.20.0/go.mod h1:z8BVo6PvndSri0LbOE3hAn0apkU+1YvI6E70E9jsnvY= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= @@ -1480,6 +1480,8 @@ golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= @@ -1488,6 +1490,8 @@ golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U= +golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= +golang.org/x/term v0.15.0/go.mod h1:BDl952bC7+uMoWR75FIrCDx79TPU9oHkTZ9yRbYOrX0= golang.org/x/term v0.16.0 h1:m+B6fahuftsE9qjo0VWp2FW0mB3MTJvR0BaMQrq0pmE= golang.org/x/term v0.16.0/go.mod h1:yn7UURbUtPyrVJPGPq404EukNFxcm/foM+bV/bfcDsY= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -1503,6 +1507,7 @@ golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= +golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= diff --git a/vendor/code.gitea.io/sdk/gitea/client.go b/vendor/code.gitea.io/sdk/gitea/client.go index 22f0eedd4d8..adbadc7fc07 100644 --- a/vendor/code.gitea.io/sdk/gitea/client.go +++ b/vendor/code.gitea.io/sdk/gitea/client.go @@ -12,9 +12,9 @@ import ( "errors" "fmt" "io" - "io/ioutil" "net/http" "net/url" + "strconv" "strings" "sync" @@ -36,6 +36,7 @@ type Client struct { password string otp string sudo string + userAgent string debug bool httpsigner *HTTPSign client *http.Client @@ -49,6 +50,11 @@ type Client struct { // Response represents the gitea response type Response struct { *http.Response + + FirstPage int + PrevPage int + NextPage int + LastPage int } // ClientOption are functions used to init a new client @@ -215,6 +221,21 @@ func (c *Client) SetSudo(sudo string) { c.mutex.Unlock() } +// SetUserAgent is an option for NewClient to set user-agent header +func SetUserAgent(userAgent string) ClientOption { + return func(client *Client) error { + client.SetUserAgent(userAgent) + return nil + } +} + +// SetUserAgent sets the user-agent to send with every request. +func (c *Client) SetUserAgent(userAgent string) { + c.mutex.Lock() + c.userAgent = userAgent + c.mutex.Unlock() +} + // SetDebugMode is an option for NewClient to enable debug mode func SetDebugMode() ClientOption { return func(client *Client) error { @@ -225,6 +246,57 @@ func SetDebugMode() ClientOption { } } +func newResponse(r *http.Response) *Response { + response := &Response{Response: r} + response.parseLinkHeader() + + return response +} + +func (r *Response) parseLinkHeader() { + link := r.Header.Get("Link") + if link == "" { + return + } + + links := strings.Split(link, ",") + for _, l := range links { + u, param, ok := strings.Cut(l, ";") + if !ok { + continue + } + u = strings.Trim(u, " <>") + + key, value, ok := strings.Cut(strings.TrimSpace(param), "=") + if !ok || key != "rel" { + continue + } + + value = strings.Trim(value, "\"") + + parsed, err := url.Parse(u) + if err != nil { + continue + } + + page := parsed.Query().Get("page") + if page == "" { + continue + } + + switch value { + case "first": + r.FirstPage, _ = strconv.Atoi(page) + case "prev": + r.PrevPage, _ = strconv.Atoi(page) + case "next": + r.NextPage, _ = strconv.Atoi(page) + case "last": + r.LastPage, _ = strconv.Atoi(page) + } + } +} + func (c *Client) getWebResponse(method, path string, body io.Reader) ([]byte, *Response, error) { c.mutex.RLock() debug := c.debug @@ -246,11 +318,12 @@ func (c *Client) getWebResponse(method, path string, body io.Reader) ([]byte, *R } defer resp.Body.Close() - data, err := ioutil.ReadAll(resp.Body) + data, err := io.ReadAll(resp.Body) if debug { fmt.Printf("Response: %v\n\n", resp) } - return data, &Response{resp}, err + + return data, newResponse(resp), err } func (c *Client) doRequest(method, path string, header http.Header, body io.Reader) (*Response, error) { @@ -259,7 +332,7 @@ func (c *Client) doRequest(method, path string, header http.Header, body io.Read if debug { var bodyStr string if body != nil { - bs, _ := ioutil.ReadAll(body) + bs, _ := io.ReadAll(body) body = bytes.NewReader(bs) bodyStr = string(bs) } @@ -282,6 +355,9 @@ func (c *Client) doRequest(method, path string, header http.Header, body io.Read if len(c.sudo) != 0 { req.Header.Set("Sudo", c.sudo) } + if len(c.userAgent) != 0 { + req.Header.Set("User-Agent", c.userAgent) + } client := c.client // client ref can change from this point on so safe it c.mutex.RUnlock() @@ -304,7 +380,8 @@ func (c *Client) doRequest(method, path string, header http.Header, body io.Read if debug { fmt.Printf("Response: %v\n\n", resp) } - return &Response{resp}, nil + + return newResponse(resp), nil } // Converts a response for a HTTP status code indicating an error condition @@ -321,7 +398,7 @@ func statusCodeToErr(resp *Response) (body []byte, err error) { // error: body will be read for details // defer resp.Body.Close() - data, err := ioutil.ReadAll(resp.Body) + data, err := io.ReadAll(resp.Body) if err != nil { return nil, fmt.Errorf("body read on HTTP error %d: %v", resp.StatusCode, err) } @@ -374,7 +451,7 @@ func (c *Client) getResponse(method, path string, header http.Header, body io.Re } // success (2XX), read body - data, err = ioutil.ReadAll(resp.Body) + data, err = io.ReadAll(resp.Body) if err != nil { return nil, resp, err } diff --git a/vendor/code.gitea.io/sdk/gitea/hook.go b/vendor/code.gitea.io/sdk/gitea/hook.go index 67a7518b68d..bdc80a10993 100644 --- a/vendor/code.gitea.io/sdk/gitea/hook.go +++ b/vendor/code.gitea.io/sdk/gitea/hook.go @@ -95,11 +95,12 @@ func (c *Client) GetRepoHook(user, repo string, id int64) (*Hook, *Response, err // CreateHookOption options when create a hook type CreateHookOption struct { - Type HookType `json:"type"` - Config map[string]string `json:"config"` - Events []string `json:"events"` - BranchFilter string `json:"branch_filter"` - Active bool `json:"active"` + Type HookType `json:"type"` + Config map[string]string `json:"config"` + Events []string `json:"events"` + BranchFilter string `json:"branch_filter"` + Active bool `json:"active"` + AuthorizationHeader string `json:"authorization_header"` } // Validate the CreateHookOption struct @@ -143,10 +144,11 @@ func (c *Client) CreateRepoHook(user, repo string, opt CreateHookOption) (*Hook, // EditHookOption options when modify one hook type EditHookOption struct { - Config map[string]string `json:"config"` - Events []string `json:"events"` - BranchFilter string `json:"branch_filter"` - Active *bool `json:"active"` + Config map[string]string `json:"config"` + Events []string `json:"events"` + BranchFilter string `json:"branch_filter"` + Active *bool `json:"active"` + AuthorizationHeader string `json:"authorization_header"` } // EditOrgHook modify one hook of an organization, with hook id and options diff --git a/vendor/code.gitea.io/sdk/gitea/org_team.go b/vendor/code.gitea.io/sdk/gitea/org_team.go index e7caa5ae863..9c02e85835e 100644 --- a/vendor/code.gitea.io/sdk/gitea/org_team.go +++ b/vendor/code.gitea.io/sdk/gitea/org_team.go @@ -45,6 +45,8 @@ const ( RepoUnitProjects RepoUnitType = "repo.projects" // RepoUnitPackages represents packages of a repository RepoUnitPackages RepoUnitType = "repo.packages" + // RepoUnitActions represents actions of a repository + RepoUnitActions RepoUnitType = "repo.actions" ) // ListTeamsOptions options for listing teams diff --git a/vendor/code.gitea.io/sdk/gitea/release.go b/vendor/code.gitea.io/sdk/gitea/release.go index 3200f203430..3a834173ad7 100644 --- a/vendor/code.gitea.io/sdk/gitea/release.go +++ b/vendor/code.gitea.io/sdk/gitea/release.go @@ -190,7 +190,7 @@ func (c *Client) fallbackGetReleaseByTag(owner, repo, tag string) (*Release, *Re } if len(rl) == 0 { return nil, - &Response{&http.Response{StatusCode: 404}}, + newResponse(&http.Response{StatusCode: 404}), fmt.Errorf("release with tag '%s' not found", tag) } for _, r := range rl { diff --git a/vendor/code.gitea.io/sdk/gitea/repo.go b/vendor/code.gitea.io/sdk/gitea/repo.go index 8f0e346abef..79aa52d470e 100644 --- a/vendor/code.gitea.io/sdk/gitea/repo.go +++ b/vendor/code.gitea.io/sdk/gitea/repo.go @@ -85,6 +85,9 @@ type Repository struct { ExternalWiki *ExternalWiki `json:"external_wiki,omitempty"` HasPullRequests bool `json:"has_pull_requests"` HasProjects bool `json:"has_projects"` + HasReleases bool `json:"has_releases,omitempty"` + HasPackages bool `json:"has_packages,omitempty"` + HasActions bool `json:"has_actions,omitempty"` IgnoreWhitespaceConflicts bool `json:"ignore_whitespace_conflicts"` AllowMerge bool `json:"allow_merge_commits"` AllowRebase bool `json:"allow_rebase"` @@ -331,8 +334,8 @@ func (opt CreateRepoOption) Validate(c *Client) error { if len(opt.Name) > 100 { return fmt.Errorf("name has more than 100 chars") } - if len(opt.Description) > 255 { - return fmt.Errorf("description has more than 255 chars") + if len(opt.Description) > 2048 { + return fmt.Errorf("description has more than 2048 chars") } if len(opt.DefaultBranch) > 100 { return fmt.Errorf("default branch name has more than 100 chars") @@ -423,6 +426,12 @@ type EditRepoOption struct { HasPullRequests *bool `json:"has_pull_requests,omitempty"` // either `true` to enable project unit, or `false` to disable them. HasProjects *bool `json:"has_projects,omitempty"` + // either `true` to enable release, or `false` to disable them. + HasReleases *bool `json:"has_releases,omitempty"` + // either `true` to enable packages, or `false` to disable them. + HasPackages *bool `json:"has_packages,omitempty"` + // either `true` to enable actions, or `false` to disable them. + HasActions *bool `json:"has_actions,omitempty"` // either `true` to ignore whitespace for conflicts, or `false` to not ignore whitespace. `has_pull_requests` must be `true`. IgnoreWhitespaceConflicts *bool `json:"ignore_whitespace_conflicts,omitempty"` // either `true` to allow merging pull requests with a merge commit, or `false` to prevent merging pull requests with merge commits. `has_pull_requests` must be `true`. diff --git a/vendor/code.gitea.io/sdk/gitea/repo_file.go b/vendor/code.gitea.io/sdk/gitea/repo_file.go index bcba705129c..79bbeb10391 100644 --- a/vendor/code.gitea.io/sdk/gitea/repo_file.go +++ b/vendor/code.gitea.io/sdk/gitea/repo_file.go @@ -10,7 +10,6 @@ import ( "encoding/json" "fmt" "io" - "io/ioutil" "net/url" "strings" ) @@ -128,7 +127,7 @@ func (c *Client) GetFile(owner, repo, ref, filepath string, resolveLFS ...bool) } defer reader.Close() - data, err2 := ioutil.ReadAll(reader) + data, err2 := io.ReadAll(reader) if err2 != nil { return nil, resp, err2 } diff --git a/vendor/code.gitea.io/sdk/gitea/repo_migrate.go b/vendor/code.gitea.io/sdk/gitea/repo_migrate.go index 3ab690e53e0..2de2153605f 100644 --- a/vendor/code.gitea.io/sdk/gitea/repo_migrate.go +++ b/vendor/code.gitea.io/sdk/gitea/repo_migrate.go @@ -62,7 +62,7 @@ func (opt *MigrateRepoOption) Validate(c *Client) error { } else if len(opt.RepoName) > 100 { return fmt.Errorf("RepoName to long") } - if len(opt.Description) > 255 { + if len(opt.Description) > 2048 { return fmt.Errorf("Description to long") } switch opt.Service { diff --git a/vendor/code.gitea.io/sdk/gitea/repo_mirror.go b/vendor/code.gitea.io/sdk/gitea/repo_mirror.go new file mode 100644 index 00000000000..df320940a96 --- /dev/null +++ b/vendor/code.gitea.io/sdk/gitea/repo_mirror.go @@ -0,0 +1,45 @@ +// Copyright 2023 The Gitea Authors. All rights reserved. +// Use of this source code is governed by a MIT-style +// license that can be found in the LICENSE file. + +package gitea + +import ( + "bytes" + "encoding/json" + "fmt" +) + +type CreatePushMirrorOption struct { + Interval string `json:"interval"` + RemoteAddress string `json:"remote_address"` + RemotePassword string `json:"remote_password"` + RemoteUsername string `json:"remote_username"` + SyncONCommit bool `json:"sync_on_commit"` +} + +// PushMirrorResponse returns a git push mirror +type PushMirrorResponse struct { + Created string `json:"created"` + Interval string `json:"interval"` + LastError string `json:"last_error"` + LastUpdate string `json:"last_update"` + RemoteAddress string `json:"remote_address"` + RemoteName string `json:"remote_name"` + RepoName string `json:"repo_name"` + SyncONCommit bool `json:"sync_on_commit"` +} + +// PushMirrors add a push mirror to the repository +func (c *Client) PushMirrors(user, repo string, opt CreatePushMirrorOption) (*PushMirrorResponse, *Response, error) { + if err := escapeValidatePathSegments(&user, &repo); err != nil { + return nil, nil, err + } + body, err := json.Marshal(opt) + if err != nil { + return nil, nil, err + } + pm := new(PushMirrorResponse) + resp, err := c.getParsedResponse("POST", fmt.Sprintf("/repos/%s/%s/push_mirrors", user, repo), jsonHeader, bytes.NewReader(body), &pm) + return pm, resp, err +} diff --git a/vendor/modules.txt b/vendor/modules.txt index de208a37347..e6456ee7845 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -13,7 +13,7 @@ cloud.google.com/go/iam/apiv1/iampb cloud.google.com/go/kms/apiv1 cloud.google.com/go/kms/apiv1/kmspb cloud.google.com/go/kms/internal -# code.gitea.io/sdk/gitea v0.16.0 +# code.gitea.io/sdk/gitea v0.17.1 ## explicit; go 1.13 code.gitea.io/sdk/gitea # contrib.go.opencensus.io/exporter/ocagent v0.7.1-0.20200907061046-05415f1de66d