diff --git a/go.mod b/go.mod
index b85ab544f77611a16c4c26c2ba4542eb433c5395..92a62c7113f01cecdf97f6ee15f0cdcc3fc9c53a 100644
--- a/go.mod
+++ b/go.mod
@@ -3,7 +3,7 @@ module gitee.com/openeuler/ci-bot
go 1.13
require (
- gitee.com/openeuler/go-gitee v0.0.0-20200320051710-5687412fb922
+ gitee.com/openeuler/go-gitee v0.0.0-20200424023021-ced5a4d67179
github.com/antihax/optional v1.0.0
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b
github.com/golang/protobuf v1.3.2 // indirect
diff --git a/go.sum b/go.sum
index 2292421741e719765d3480c08be238610105b1c6..7edc2d7fb3252dedb60acdf72140ab7e80de6ffa 100644
--- a/go.sum
+++ b/go.sum
@@ -4,6 +4,12 @@ cloud.google.com/go v0.37.4 h1:glPeL3BQJsbF6aIIYfZizMwc5LTYz250bDMjttbBGAU=
cloud.google.com/go v0.37.4/go.mod h1:NHPJ89PdicEuT9hdPXMROBD91xc5uRDxsMtSB16k7hw=
gitee.com/openeuler/go-gitee v0.0.0-20200320051710-5687412fb922 h1:tH5xYCmBLUEgqr8QaplXvk7ciguomHNPY5sJVHFtsBI=
gitee.com/openeuler/go-gitee v0.0.0-20200320051710-5687412fb922/go.mod h1:TQrS/LP/DFXLqM+lVrZd4nL2pbTrqiXABGT9PJepVTA=
+gitee.com/openeuler/go-gitee v0.0.0-20200407034142-9d0d3521129a h1:uakoqruiLVLw8UphAQWbu1L4wEUq4cbt+sK7WxrNeVw=
+gitee.com/openeuler/go-gitee v0.0.0-20200421085606-b5c14af251af h1:anPYokl5XfI3WdFQB5OUzsbY+EvkG77gO1FU6vaiptI=
+gitee.com/openeuler/go-gitee v0.0.0-20200423030551-27093fdcaf21 h1:IVayS8PZbOQQ8Cu8Y3wdG2lMaqVT7Zrt8OErhsxPiHE=
+gitee.com/openeuler/go-gitee v0.0.0-20200423113229-786eaacbb974 h1:wlwVb3CNYOf/5yo+ZCwopBGyQNJfh9KypIbuopSKiyY=
+gitee.com/openeuler/go-gitee v0.0.0-20200424023021-ced5a4d67179 h1:7bHzennVUJlv27Gljny95CyXknEBrfmHL6KdHCuHumM=
+gitee.com/openeuler/go-gitee v0.0.0-20200424023021-ced5a4d67179/go.mod h1:TQrS/LP/DFXLqM+lVrZd4nL2pbTrqiXABGT9PJepVTA=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo=
github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI=
diff --git a/pkg/cibot/inithandler.go b/pkg/cibot/inithandler.go
index 8050793fa783c2f68c69cd1dedfd8bf480284d0c..be406d0c38491616b6795a2c3f2b4081b3eb38ab 100644
--- a/pkg/cibot/inithandler.go
+++ b/pkg/cibot/inithandler.go
@@ -971,7 +971,7 @@ func (handler *InitHandler) addBranchProtections(c Community, r Repository, mapB
}
// If branch has alreay been protected, no need for protection
- if branchObj.Protected == "true" {
+ if branchObj.Protected == true {
glog.Errorf("branch %s has been protected already, no need for protection", v)
continue
}
diff --git a/pkg/cibot/pullrequest.go b/pkg/cibot/pullrequest.go
index 5e7e93271e9728c9402dc232979a97de739511e6..bb1443ca52af6a7b3f919e47c178e3447b7c53e6 100644
--- a/pkg/cibot/pullrequest.go
+++ b/pkg/cibot/pullrequest.go
@@ -67,106 +67,154 @@ func (s *Server) HandlePullRequestEvent(event *gitee.PullRequestEvent) {
}
case "merge":
glog.Info("Received a pull request merge event")
- diff := ""
- prjname := ""
- existinprj := false
- // get pr commit file list
- owner := event.Repository.Namespace
- repo := event.Repository.Name
- number := event.PullRequest.Number
- lvos := &gitee.GetV5ReposOwnerRepoPullsNumberFilesOpts{}
- lvos.AccessToken = optional.NewString(s.Config.GiteeToken)
- fls, _, err := s.GiteeClient.PullRequestsApi.GetV5ReposOwnerRepoPullsNumberFiles(s.Context, owner, repo, number, lvos)
- if err != nil {
- glog.Errorf("unable to get pr file list. err: %v", err)
+ diff := s.CheckSpecialFileHasModified(event, "src-openeuler.yaml")
+ if diff == "" {
+ return
+ }
+ prjnames := ParseDiffInfoAndGetProjectName(diff)
+ if 0 == len(prjnames) {
return
}
- // check yaml has modified? and get diff
- for _, file := range fls {
- glog.Infof(file.Patch.Diff)
- if strings.Contains(file.Filename, "src-openeuler.yaml") {
- glog.Infof("src-openeuler.yaml has been modified")
- diff = file.Patch.Diff
- break
+ repo := "infrastructure"
+ branch := "master"
+ for _, prjn := range prjnames {
+ exist := s.CheckWetherNewItemInObsProjects(event, prjn, branch, repo)
+ if true == exist {
+ glog.Infof("Project(%v) is in obs already.", prjn)
+ continue
}
+ glog.Infof("Begin to create new project file, project name:%v.", prjn)
+ _servicepath, _servicecontent := FillServicePathAndContentWithProjectName(prjn)
+ s.NewFileWithPathAndContentInPullRequest(event, _servicepath, _servicecontent, branch, repo)
+ _metapath, _metacontent := FillMetaPathAndContentWithProjectName(prjn)
+ s.NewFileWithPathAndContentInPullRequest(event, _metapath, _metacontent, branch, repo)
}
+ }
+}
- // get the yaml diff
- glog.Infof(diff)
- if strings.Contains(diff, "+- name:") {
- difs := strings.Fields(diff)
- glog.Infof(difs[0])
- for idx, str := range difs {
- // glog.Infof(str)
- if str == "+-" && difs[idx+1] == "name:" {
- prjname = difs[idx+2]
- glog.Infof(prjname)
- }
+// parse diff info
+func ParseDiffInfoAndGetProjectName(diff string) (prjnames []string) {
+ if strings.Contains(diff, "+- name:") {
+ difs := strings.Fields(diff)
+ for idx, str := range difs {
+ // glog.Infof(str)
+ if (str == "+-") && (difs[idx+1] == "name:") {
+ prjnames = append(prjnames, difs[idx+2])
+ glog.Infof(prjnames[0])
}
}
+ }
+ return
+}
- // get branch sha value for getting repo tree
- repoinfra := "infrastructure"
- branchm := "master"
- lvosbranch := &gitee.GetV5ReposOwnerRepoBranchesBranchOpts{}
- lvosbranch.AccessToken = optional.NewString(s.Config.GiteeToken)
- branch, _, err := s.GiteeClient.RepositoriesApi.GetV5ReposOwnerRepoBranchesBranch(s.Context, owner, repoinfra, branchm, lvosbranch)
-
- // look up the obs project in infrastructure
- treesha := branch.Commit.Sha
- lvostree := &gitee.GetV5ReposOwnerRepoGitTreesShaOpts{}
- lvostree.AccessToken = optional.NewString(s.Config.GiteeToken)
- lvostree.Recursive = optional.NewInt32(1)
- tree, _, err := s.GiteeClient.GitDataApi.GetV5ReposOwnerRepoGitTreesSha(s.Context, owner, repoinfra, treesha, lvostree)
- for _, dir := range tree.Tree {
- if strings.Contains(dir.Path, "/"+prjname+"/") {
- glog.Infof("path:%v, sha:%v", dir.Path, dir.Sha)
- existinprj = true
- }
+// Get the diff info with merge and choose projects to be added
+func (s *Server) CheckSpecialFileHasModified(event *gitee.PullRequestEvent, specialfile string) (diff string) {
+ diff = ""
+ if event == nil {
+ return
+ }
+ // get pr commit file list
+ owner := event.Repository.Namespace
+ repo := event.Repository.Name
+ number := event.PullRequest.Number
+ lvos := &gitee.GetV5ReposOwnerRepoPullsNumberFilesOpts{}
+ lvos.AccessToken = optional.NewString(s.Config.GiteeToken)
+ fls, _, err := s.GiteeClient.PullRequestsApi.GetV5ReposOwnerRepoPullsNumberFiles(s.Context, owner, repo, number, lvos)
+ if err != nil {
+ glog.Errorf("unable to get pr file list. err: %v", err)
+ return
+ }
+ // check special file has modified and get diff
+ for _, file := range fls {
+ if strings.Contains(file.Filename, specialfile) {
+ glog.Infof("%v has been modified", specialfile)
+ diff = file.Patch.Diff
+ break
}
+ }
+ return
+}
- // if not exist in obs project
- if existinprj {
- glog.Infof("Project already in obs, do not need create.")
- return
+// Check whether the new item in src-openeuler.yaml is in project
+func (s *Server) CheckWetherNewItemInObsProjects(event *gitee.PullRequestEvent, prjname string, branch string, repo string) (exist bool) {
+ exist = false
+ if event == nil {
+ return
+ }
+
+ // get the sha of branch
+ owner := event.Repository.Namespace
+ lvosbranch := &gitee.GetV5ReposOwnerRepoBranchesBranchOpts{}
+ lvosbranch.AccessToken = optional.NewString(s.Config.GiteeToken)
+ bdetail, _, err := s.GiteeClient.RepositoriesApi.GetV5ReposOwnerRepoBranchesBranch(s.Context, owner, repo, branch, lvosbranch)
+ if err != nil {
+ glog.Errorf("Get branch(%v) repo(%v) detail info failed: %v", branch, repo, err)
+ return
+ }
+
+ // look up the obs project in infrastructure
+ treesha := bdetail.Commit.Sha
+ lvostree := &gitee.GetV5ReposOwnerRepoGitTreesShaOpts{}
+ lvostree.AccessToken = optional.NewString(s.Config.GiteeToken)
+ lvostree.Recursive = optional.NewInt32(1)
+ tree, _, err := s.GiteeClient.GitDataApi.GetV5ReposOwnerRepoGitTreesSha(s.Context, owner, repo, treesha, lvostree)
+ if err != nil {
+ glog.Errorf("Get menu tree of branch(%v) repo(%v) failed: %v", branch, repo, err)
+ return
+ }
+ for _, dir := range tree.Tree {
+ if strings.Contains(dir.Path, "/"+prjname+"/") {
+ glog.Infof("Find the project path:%v, sha:%v", dir.Path, dir.Sha)
+ exist = true
+ break
}
+ }
+ return
+}
- glog.Infof("Begin to create new project file, project name:%v.", prjname)
-
- newfbody := gitee.NewFileParam{}
- newfbody.AccessToken = s.Config.GiteeToken
- newfbody.AuthorName = event.PullRequest.User.Login
- newfbody.AuthorEmail = event.PullRequest.User.Email
- newfbody.CommitterName = event.PullRequest.User.Login
- newfbody.CommitterEmail = event.PullRequest.User.Email
- newfbody.Branch = branchm
- newfbody.Message = "add project according to src-openeuler.yaml in repo community."
-
- // add _service file
- _servicepath := "obs/team_usage/obs_meta/projects/openEuler:Mainline/" + prjname + "/_service"
- _service := "\n" +
- " \n" +
- " repo\n" +
- " next/openEuler/" + prjname + "\n" +
- " \n" +
- ""
- _serbase64 := base64.StdEncoding.EncodeToString([]byte(_service))
- newfbody.Content = _serbase64
- s.GiteeClient.RepositoriesApi.PostV5ReposOwnerRepoContentsPath(s.Context, owner, repoinfra, _servicepath, newfbody)
-
- // add _meta file
- _metapath := "obs/team_usage/obs_meta/projects/openEuler:Mainline/" + prjname + "/.osc/_meta"
- _meta := "\n" +
- " \n" +
- " \n" +
- "\n"
- _metabase64 := base64.StdEncoding.EncodeToString([]byte(_meta))
- newfbody.Content = _metabase64
- //glog.Infof("owner:%v, repo:%v, _metapath:%v, _meta:%v", owner, repoinfra, _metapath, _meta)
- s.GiteeClient.RepositoriesApi.PostV5ReposOwnerRepoContentsPath(s.Context, owner, repoinfra, _metapath, newfbody)
+// Fill file _service path and content
+func FillServicePathAndContentWithProjectName(prjname string) (_servicepath string, _service string) {
+ _servicepath = "obs/team_usage/obs_meta/projects/openEuler:Mainline/" + prjname + "/_service"
+ _service = "\n" +
+ " \n" +
+ " repo\n" +
+ " next/openEuler/" + prjname + "\n" +
+ " \n" +
+ ""
+ return
+}
+
+// Fill file _meta path and content
+func FillMetaPathAndContentWithProjectName(prjname string) (_metapath string, _meta string) {
+ _metapath = "obs/team_usage/obs_meta/projects/openEuler:Mainline/" + prjname + "/.osc/_meta"
+ _meta = "\n" +
+ " \n" +
+ " \n" +
+ "\n"
+ return
+}
+
+// New project with name in pull
+func (s *Server) NewFileWithPathAndContentInPullRequest(event *gitee.PullRequestEvent, path string, content string, branch string, repo string) {
+ if event == nil {
+ return
}
+ owner := event.Repository.Namespace
+ newfbody := gitee.NewFileParam{}
+ newfbody.AccessToken = s.Config.GiteeToken
+ newfbody.AuthorName = event.PullRequest.User.Login
+ newfbody.AuthorEmail = event.PullRequest.User.Email
+ newfbody.CommitterName = event.PullRequest.User.Login
+ newfbody.CommitterEmail = event.PullRequest.User.Email
+ newfbody.Branch = branch
+ newfbody.Message = "add project according to src-openeuler.yaml in repo community."
+
+ contentbase64 := base64.StdEncoding.EncodeToString([]byte(content))
+ newfbody.Content = contentbase64
+ s.GiteeClient.RepositoriesApi.PostV5ReposOwnerRepoContentsPath(s.Context, owner, repo, path, newfbody)
+ return
}
// RemoveAssigneesInPullRequest remove assignees in pull request
diff --git a/pkg/cibot/repohandler.go b/pkg/cibot/repohandler.go
index caf174212768cf5c35aea76f457f4dd73f73c081..22eb8d2f0e7c1dea83dfd05ae78a4da29142b924 100644
--- a/pkg/cibot/repohandler.go
+++ b/pkg/cibot/repohandler.go
@@ -498,7 +498,7 @@ func (handler *RepoHandler) addBranchProtections(community string, r Repository,
}
// If branch has alreay been protected, no need for protection
- if branchObj.Protected == "true" {
+ if branchObj.Protected == true {
glog.Errorf("branch %s has been protected already, no need for protection", v)
continue
}
diff --git a/vendor/gitee.com/openeuler/go-gitee/gitee/api_pull_requests.go b/vendor/gitee.com/openeuler/go-gitee/gitee/api_pull_requests.go
index 8eb1c324189f17ff9a1a9501fb30b5ddb2081504..01845a84328dd3ab5657f7a9e4db3dd78bbd4202 100644
--- a/vendor/gitee.com/openeuler/go-gitee/gitee/api_pull_requests.go
+++ b/vendor/gitee.com/openeuler/go-gitee/gitee/api_pull_requests.go
@@ -109,6 +109,91 @@ func (a *PullRequestsApiService) DeleteV5ReposOwnerRepoPullsCommentsId(ctx conte
return localVarHttpResponse, nil
}
+/*
+PullRequestsApiService 删除 Pull Request 标签
+删除 Pull Request 标签
+ * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
+ * @param owner 仓库所属空间地址(企业、组织或个人的地址path)
+ * @param repo 仓库路径(path)
+ * @param number 第几个PR,即本仓库PR的序数
+ * @param name 标签名称
+ * @param optional nil or *DeleteV5ReposOwnerRepoPullsLabelOpts - Optional Parameters:
+ * @param "AccessToken" (optional.String) - 用户授权码
+
+
+*/
+
+type DeleteV5ReposOwnerRepoPullsLabelOpts struct {
+ AccessToken optional.String
+}
+
+func (a *PullRequestsApiService) DeleteV5ReposOwnerRepoPullsLabel(ctx context.Context, owner string, repo string, number int32, name string, localVarOptionals *DeleteV5ReposOwnerRepoPullsLabelOpts) (*http.Response, error) {
+ var (
+ localVarHttpMethod = strings.ToUpper("Delete")
+ localVarPostBody interface{}
+ localVarFileName string
+ localVarFileBytes []byte
+ )
+
+ // create path and map variables
+ localVarPath := a.client.cfg.BasePath + "/v5/repos/{owner}/{repo}/pulls/{number}/labels/{name}"
+ localVarPath = strings.Replace(localVarPath, "{"+"owner"+"}", fmt.Sprintf("%v", owner), -1)
+ localVarPath = strings.Replace(localVarPath, "{"+"repo"+"}", fmt.Sprintf("%v", repo), -1)
+ localVarPath = strings.Replace(localVarPath, "{"+"number"+"}", fmt.Sprintf("%v", number), -1)
+ localVarPath = strings.Replace(localVarPath, "{"+"name"+"}", fmt.Sprintf("%v", name), -1)
+
+ localVarHeaderParams := make(map[string]string)
+ localVarQueryParams := url.Values{}
+ localVarFormParams := url.Values{}
+
+ if localVarOptionals != nil && localVarOptionals.AccessToken.IsSet() {
+ localVarQueryParams.Add("access_token", parameterToString(localVarOptionals.AccessToken.Value(), ""))
+ }
+ // to determine the Content-Type header
+ localVarHttpContentTypes := []string{"application/json", "multipart/form-data"}
+
+ // set Content-Type header
+ localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
+ if localVarHttpContentType != "" {
+ localVarHeaderParams["Content-Type"] = localVarHttpContentType
+ }
+
+ // to determine the Accept header
+ localVarHttpHeaderAccepts := []string{"application/json"}
+
+ // set Accept header
+ localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
+ if localVarHttpHeaderAccept != "" {
+ localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
+ }
+ r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
+ if err != nil {
+ return nil, err
+ }
+
+ localVarHttpResponse, err := a.client.callAPI(r)
+ if err != nil || localVarHttpResponse == nil {
+ return localVarHttpResponse, err
+ }
+
+ localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
+ localVarHttpResponse.Body.Close()
+ if err != nil {
+ return localVarHttpResponse, err
+ }
+
+ if localVarHttpResponse.StatusCode >= 300 {
+ newErr := GenericSwaggerError{
+ body: localVarBody,
+ error: localVarHttpResponse.Status,
+ }
+
+ return localVarHttpResponse, newErr
+ }
+
+ return localVarHttpResponse, nil
+}
+
/*
PullRequestsApiService 取消用户审查 Pull Request
取消用户审查 Pull Request
@@ -1116,6 +1201,119 @@ func (a *PullRequestsApiService) GetV5ReposOwnerRepoPullsNumberFiles(ctx context
return localVarReturnValue, localVarHttpResponse, nil
}
+/*
+PullRequestsApiService 获取某个 Pull Request 的所有标签
+获取某个 Pull Request 的所有标签
+ * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
+ * @param owner 仓库所属空间地址(企业、组织或个人的地址path)
+ * @param repo 仓库路径(path)
+ * @param number 第几个PR,即本仓库PR的序数
+ * @param optional nil or *GetV5ReposOwnerRepoPullsNumberLabelsOpts - Optional Parameters:
+ * @param "AccessToken" (optional.String) - 用户授权码
+ * @param "Page" (optional.Int32) - 当前的页码
+ * @param "PerPage" (optional.Int32) - 每页的数量,最大为 100
+
+@return []Label
+*/
+
+type GetV5ReposOwnerRepoPullsNumberLabelsOpts struct {
+ AccessToken optional.String
+ Page optional.Int32
+ PerPage optional.Int32
+}
+
+func (a *PullRequestsApiService) GetV5ReposOwnerRepoPullsNumberLabels(ctx context.Context, owner string, repo string, number int32, localVarOptionals *GetV5ReposOwnerRepoPullsNumberLabelsOpts) ([]Label, *http.Response, error) {
+ var (
+ localVarHttpMethod = strings.ToUpper("Get")
+ localVarPostBody interface{}
+ localVarFileName string
+ localVarFileBytes []byte
+ localVarReturnValue []Label
+ )
+
+ // create path and map variables
+ localVarPath := a.client.cfg.BasePath + "/v5/repos/{owner}/{repo}/pulls/{number}/labels"
+ localVarPath = strings.Replace(localVarPath, "{"+"owner"+"}", fmt.Sprintf("%v", owner), -1)
+ localVarPath = strings.Replace(localVarPath, "{"+"repo"+"}", fmt.Sprintf("%v", repo), -1)
+ localVarPath = strings.Replace(localVarPath, "{"+"number"+"}", fmt.Sprintf("%v", number), -1)
+
+ localVarHeaderParams := make(map[string]string)
+ localVarQueryParams := url.Values{}
+ localVarFormParams := url.Values{}
+
+ if localVarOptionals != nil && localVarOptionals.AccessToken.IsSet() {
+ localVarQueryParams.Add("access_token", parameterToString(localVarOptionals.AccessToken.Value(), ""))
+ }
+ if localVarOptionals != nil && localVarOptionals.Page.IsSet() {
+ localVarQueryParams.Add("page", parameterToString(localVarOptionals.Page.Value(), ""))
+ }
+ if localVarOptionals != nil && localVarOptionals.PerPage.IsSet() {
+ localVarQueryParams.Add("per_page", parameterToString(localVarOptionals.PerPage.Value(), ""))
+ }
+ // to determine the Content-Type header
+ localVarHttpContentTypes := []string{"application/json", "multipart/form-data"}
+
+ // set Content-Type header
+ localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
+ if localVarHttpContentType != "" {
+ localVarHeaderParams["Content-Type"] = localVarHttpContentType
+ }
+
+ // to determine the Accept header
+ localVarHttpHeaderAccepts := []string{"application/json"}
+
+ // set Accept header
+ localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
+ if localVarHttpHeaderAccept != "" {
+ localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
+ }
+ r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
+ if err != nil {
+ return localVarReturnValue, nil, err
+ }
+
+ localVarHttpResponse, err := a.client.callAPI(r)
+ if err != nil || localVarHttpResponse == nil {
+ return localVarReturnValue, localVarHttpResponse, err
+ }
+
+ localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
+ localVarHttpResponse.Body.Close()
+ if err != nil {
+ return localVarReturnValue, localVarHttpResponse, err
+ }
+
+ if localVarHttpResponse.StatusCode < 300 {
+ // If we succeed, return the data, otherwise pass on to decode error.
+ err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
+ if err == nil {
+ return localVarReturnValue, localVarHttpResponse, err
+ }
+ }
+
+ if localVarHttpResponse.StatusCode >= 300 {
+ newErr := GenericSwaggerError{
+ body: localVarBody,
+ error: localVarHttpResponse.Status,
+ }
+
+ if localVarHttpResponse.StatusCode == 200 {
+ var v []Label
+ err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
+ if err != nil {
+ newErr.error = err.Error()
+ return localVarReturnValue, localVarHttpResponse, newErr
+ }
+ newErr.model = v
+ return localVarReturnValue, localVarHttpResponse, newErr
+ }
+
+ return localVarReturnValue, localVarHttpResponse, newErr
+ }
+
+ return localVarReturnValue, localVarHttpResponse, nil
+}
+
/*
PullRequestsApiService 判断Pull Request是否已经合并
判断Pull Request是否已经合并
@@ -1514,34 +1712,11 @@ PullRequestsApiService 创建Pull Request
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param owner 仓库所属空间地址(企业、组织或个人的地址path)
* @param repo 仓库路径(path)
- * @param title 必填。Pull Request 标题
- * @param head 必填。Pull Request 提交的源分支。格式:branch 或者:username:branch
- * @param base 必填。Pull Request 提交目标分支的名称
- * @param optional nil or *PostV5ReposOwnerRepoPullsOpts - Optional Parameters:
- * @param "AccessToken" (optional.String) - 用户授权码
- * @param "Body" (optional.String) - 可选。Pull Request 内容
- * @param "MilestoneNumber" (optional.Int32) - 可选。里程碑序号(id)
- * @param "Labels" (optional.String) - 用逗号分开的标签,名称要求长度在 2-20 之间且非特殊字符。如: bug,performance
- * @param "Issue" (optional.String) - 可选。Pull Request的标题和内容可以根据指定的Issue Id自动填充
- * @param "Assignees" (optional.String) - 可选。审查人员username,可多个,半角逗号分隔,如:(username1,username2)
- * @param "Testers" (optional.String) - 可选。测试人员username,可多个,半角逗号分隔,如:(username1,username2)
- * @param "PruneSourceBranch" (optional.Bool) - 可选。合并PR后是否删除源分支,默认false(不删除)
+ * @param body pr的信息
@return PullRequest
*/
-
-type PostV5ReposOwnerRepoPullsOpts struct {
- AccessToken optional.String
- Body optional.String
- MilestoneNumber optional.Int32
- Labels optional.String
- Issue optional.String
- Assignees optional.String
- Testers optional.String
- PruneSourceBranch optional.Bool
-}
-
-func (a *PullRequestsApiService) PostV5ReposOwnerRepoPulls(ctx context.Context, owner string, repo string, title string, head string, base string, localVarOptionals *PostV5ReposOwnerRepoPullsOpts) (PullRequest, *http.Response, error) {
+func (a *PullRequestsApiService) PostV5ReposOwnerRepoPulls(ctx context.Context, owner string, repo string, body CreatePullRequestParam) (PullRequest, *http.Response, error) {
var (
localVarHttpMethod = strings.ToUpper("Post")
localVarPostBody interface{}
@@ -1576,33 +1751,8 @@ func (a *PullRequestsApiService) PostV5ReposOwnerRepoPulls(ctx context.Context,
if localVarHttpHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
}
- if localVarOptionals != nil && localVarOptionals.AccessToken.IsSet() {
- localVarFormParams.Add("access_token", parameterToString(localVarOptionals.AccessToken.Value(), ""))
- }
- localVarFormParams.Add("title", parameterToString(title, ""))
- localVarFormParams.Add("head", parameterToString(head, ""))
- localVarFormParams.Add("base", parameterToString(base, ""))
- if localVarOptionals != nil && localVarOptionals.Body.IsSet() {
- localVarFormParams.Add("body", parameterToString(localVarOptionals.Body.Value(), ""))
- }
- if localVarOptionals != nil && localVarOptionals.MilestoneNumber.IsSet() {
- localVarFormParams.Add("milestone_number", parameterToString(localVarOptionals.MilestoneNumber.Value(), ""))
- }
- if localVarOptionals != nil && localVarOptionals.Labels.IsSet() {
- localVarFormParams.Add("labels", parameterToString(localVarOptionals.Labels.Value(), ""))
- }
- if localVarOptionals != nil && localVarOptionals.Issue.IsSet() {
- localVarFormParams.Add("issue", parameterToString(localVarOptionals.Issue.Value(), ""))
- }
- if localVarOptionals != nil && localVarOptionals.Assignees.IsSet() {
- localVarFormParams.Add("assignees", parameterToString(localVarOptionals.Assignees.Value(), ""))
- }
- if localVarOptionals != nil && localVarOptionals.Testers.IsSet() {
- localVarFormParams.Add("testers", parameterToString(localVarOptionals.Testers.Value(), ""))
- }
- if localVarOptionals != nil && localVarOptionals.PruneSourceBranch.IsSet() {
- localVarFormParams.Add("prune_source_branch", parameterToString(localVarOptionals.PruneSourceBranch.Value(), ""))
- }
+ // body params
+ localVarPostBody = &body
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
if err != nil {
return localVarReturnValue, nil, err
@@ -1657,18 +1807,11 @@ PullRequestsApiService 指派用户审查 Pull Request
* @param owner 仓库所属空间地址(企业、组织或个人的地址path)
* @param repo 仓库路径(path)
* @param number 第几个PR,即本仓库PR的序数
- * @param assignees 用户的个人空间地址, 以 , 分隔
- * @param optional nil or *PostV5ReposOwnerRepoPullsNumberAssigneesOpts - Optional Parameters:
- * @param "AccessToken" (optional.String) - 用户授权码
+ * @param body 必选,标签的内容
@return PullRequest
*/
-
-type PostV5ReposOwnerRepoPullsNumberAssigneesOpts struct {
- AccessToken optional.String
-}
-
-func (a *PullRequestsApiService) PostV5ReposOwnerRepoPullsNumberAssignees(ctx context.Context, owner string, repo string, number int32, assignees string, localVarOptionals *PostV5ReposOwnerRepoPullsNumberAssigneesOpts) (PullRequest, *http.Response, error) {
+func (a *PullRequestsApiService) PostV5ReposOwnerRepoPullsNumberAssignees(ctx context.Context, owner string, repo string, number int32, body PullRequestAssigneePostParam) (PullRequest, *http.Response, error) {
var (
localVarHttpMethod = strings.ToUpper("Post")
localVarPostBody interface{}
@@ -1704,10 +1847,8 @@ func (a *PullRequestsApiService) PostV5ReposOwnerRepoPullsNumberAssignees(ctx co
if localVarHttpHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
}
- if localVarOptionals != nil && localVarOptionals.AccessToken.IsSet() {
- localVarFormParams.Add("access_token", parameterToString(localVarOptionals.AccessToken.Value(), ""))
- }
- localVarFormParams.Add("assignees", parameterToString(assignees, ""))
+ // body params
+ localVarPostBody = &body
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
if err != nil {
return localVarReturnValue, nil, err
@@ -1851,6 +1992,102 @@ func (a *PullRequestsApiService) PostV5ReposOwnerRepoPullsNumberComments(ctx con
return localVarReturnValue, localVarHttpResponse, nil
}
+/*
+PullRequestsApiService 创建 Pull Request 标签
+创建 Pull Request 标签
+ * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
+ * @param owner 仓库所属空间地址(企业、组织或个人的地址path)
+ * @param repo 仓库路径(path)
+ * @param number 第几个PR,即本仓库PR的序数
+ * @param body 必选,标签的内容
+
+@return Label
+*/
+func (a *PullRequestsApiService) PostV5ReposOwnerRepoPullsNumberLabels(ctx context.Context, owner string, repo string, number int32, body PullRequestLabelPostParam) (Label, *http.Response, error) {
+ var (
+ localVarHttpMethod = strings.ToUpper("Post")
+ localVarPostBody interface{}
+ localVarFileName string
+ localVarFileBytes []byte
+ localVarReturnValue Label
+ )
+
+ // create path and map variables
+ localVarPath := a.client.cfg.BasePath + "/v5/repos/{owner}/{repo}/pulls/{number}/labels"
+ localVarPath = strings.Replace(localVarPath, "{"+"owner"+"}", fmt.Sprintf("%v", owner), -1)
+ localVarPath = strings.Replace(localVarPath, "{"+"repo"+"}", fmt.Sprintf("%v", repo), -1)
+ localVarPath = strings.Replace(localVarPath, "{"+"number"+"}", fmt.Sprintf("%v", number), -1)
+
+ localVarHeaderParams := make(map[string]string)
+ localVarQueryParams := url.Values{}
+ localVarFormParams := url.Values{}
+
+ // to determine the Content-Type header
+ localVarHttpContentTypes := []string{"application/json", "multipart/form-data"}
+
+ // set Content-Type header
+ localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
+ if localVarHttpContentType != "" {
+ localVarHeaderParams["Content-Type"] = localVarHttpContentType
+ }
+
+ // to determine the Accept header
+ localVarHttpHeaderAccepts := []string{"application/json"}
+
+ // set Accept header
+ localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
+ if localVarHttpHeaderAccept != "" {
+ localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
+ }
+ // body params
+ localVarPostBody = &body.Body // This shoud be &body because the gitee api is not normalized.
+ r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
+ if err != nil {
+ return localVarReturnValue, nil, err
+ }
+
+ localVarHttpResponse, err := a.client.callAPI(r)
+ if err != nil || localVarHttpResponse == nil {
+ return localVarReturnValue, localVarHttpResponse, err
+ }
+
+ localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
+ localVarHttpResponse.Body.Close()
+ if err != nil {
+ return localVarReturnValue, localVarHttpResponse, err
+ }
+
+ if localVarHttpResponse.StatusCode < 300 {
+ // If we succeed, return the data, otherwise pass on to decode error.
+ err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
+ if err == nil {
+ return localVarReturnValue, localVarHttpResponse, err
+ }
+ }
+
+ if localVarHttpResponse.StatusCode >= 300 {
+ newErr := GenericSwaggerError{
+ body: localVarBody,
+ error: localVarHttpResponse.Status,
+ }
+
+ if localVarHttpResponse.StatusCode == 201 {
+ var v Label
+ err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
+ if err != nil {
+ newErr.error = err.Error()
+ return localVarReturnValue, localVarHttpResponse, newErr
+ }
+ newErr.model = v
+ return localVarReturnValue, localVarHttpResponse, newErr
+ }
+
+ return localVarReturnValue, localVarHttpResponse, newErr
+ }
+
+ return localVarReturnValue, localVarHttpResponse, nil
+}
+
/*
PullRequestsApiService 指派用户测试 Pull Request
指派用户测试 Pull Request
diff --git a/vendor/gitee.com/openeuler/go-gitee/gitee/api_repositories.go b/vendor/gitee.com/openeuler/go-gitee/gitee/api_repositories.go
index 6df47f65b0729b41dc47b175d58372470382eb52..ccdffbb03b7b22dd75aa861fb39966a1835bab95 100644
--- a/vendor/gitee.com/openeuler/go-gitee/gitee/api_repositories.go
+++ b/vendor/gitee.com/openeuler/go-gitee/gitee/api_repositories.go
@@ -1182,20 +1182,20 @@ RepositoriesApiService 获取单个分支
* @param optional nil or *GetV5ReposOwnerRepoBranchesBranchOpts - Optional Parameters:
* @param "AccessToken" (optional.String) - 用户授权码
-@return CompleteBranch
+@return Branch
*/
type GetV5ReposOwnerRepoBranchesBranchOpts struct {
AccessToken optional.String
}
-func (a *RepositoriesApiService) GetV5ReposOwnerRepoBranchesBranch(ctx context.Context, owner string, repo string, branch string, localVarOptionals *GetV5ReposOwnerRepoBranchesBranchOpts) (CompleteBranch, *http.Response, error) {
+func (a *RepositoriesApiService) GetV5ReposOwnerRepoBranchesBranch(ctx context.Context, owner string, repo string, branch string, localVarOptionals *GetV5ReposOwnerRepoBranchesBranchOpts) (Branch, *http.Response, error) {
var (
localVarHttpMethod = strings.ToUpper("Get")
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
- localVarReturnValue CompleteBranch
+ localVarReturnValue Branch
)
// create path and map variables
@@ -1259,7 +1259,7 @@ func (a *RepositoriesApiService) GetV5ReposOwnerRepoBranchesBranch(ctx context.C
}
if localVarHttpResponse.StatusCode == 200 {
- var v CompleteBranch
+ var v Branch
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = err.Error()
@@ -1284,20 +1284,20 @@ RepositoriesApiService 获取仓库的所有成员
* @param optional nil or *GetV5ReposOwnerRepoCollaboratorsOpts - Optional Parameters:
* @param "AccessToken" (optional.String) - 用户授权码
-@return ProjectMember
+@return []ProjectMember
*/
type GetV5ReposOwnerRepoCollaboratorsOpts struct {
AccessToken optional.String
}
-func (a *RepositoriesApiService) GetV5ReposOwnerRepoCollaborators(ctx context.Context, owner string, repo string, localVarOptionals *GetV5ReposOwnerRepoCollaboratorsOpts) (ProjectMember, *http.Response, error) {
+func (a *RepositoriesApiService) GetV5ReposOwnerRepoCollaborators(ctx context.Context, owner string, repo string, localVarOptionals *GetV5ReposOwnerRepoCollaboratorsOpts) ([]ProjectMember, *http.Response, error) {
var (
localVarHttpMethod = strings.ToUpper("Get")
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
- localVarReturnValue ProjectMember
+ localVarReturnValue []ProjectMember
)
// create path and map variables
@@ -1360,7 +1360,7 @@ func (a *RepositoriesApiService) GetV5ReposOwnerRepoCollaborators(ctx context.Co
}
if localVarHttpResponse.StatusCode == 200 {
- var v ProjectMember
+ var v []ProjectMember
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = err.Error()
@@ -4638,29 +4638,11 @@ RepositoriesApiService 新建文件
* @param owner 仓库所属空间地址(企业、组织或个人的地址path)
* @param repo 仓库路径(path)
* @param path 文件的路径
- * @param content 文件内容, 要用 base64 编码
- * @param message 提交信息
- * @param optional nil or *PostV5ReposOwnerRepoContentsPathOpts - Optional Parameters:
- * @param "AccessToken" (optional.String) - 用户授权码
- * @param "Branch" (optional.String) - 分支名称。默认为仓库对默认分支
- * @param "CommitterName" (optional.String) - Committer的名字,默认为当前用户的名字
- * @param "CommitterEmail" (optional.String) - Committer的邮箱,默认为当前用户的邮箱
- * @param "AuthorName" (optional.String) - Author的名字,默认为当前用户的名字
- * @param "AuthorEmail" (optional.String) - Author的邮箱,默认为当前用户的邮箱
+ * @param body 描述文件信息
@return CommitContent
*/
-
-type PostV5ReposOwnerRepoContentsPathOpts struct {
- AccessToken optional.String
- Branch optional.String
- CommitterName optional.String
- CommitterEmail optional.String
- AuthorName optional.String
- AuthorEmail optional.String
-}
-
-func (a *RepositoriesApiService) PostV5ReposOwnerRepoContentsPath(ctx context.Context, owner string, repo string, path string, content string, message string, localVarOptionals *PostV5ReposOwnerRepoContentsPathOpts) (CommitContent, *http.Response, error) {
+func (a *RepositoriesApiService) PostV5ReposOwnerRepoContentsPath(ctx context.Context, owner string, repo string, path string, body NewFileParam) (CommitContent, *http.Response, error) {
var (
localVarHttpMethod = strings.ToUpper("Post")
localVarPostBody interface{}
@@ -4696,26 +4678,8 @@ func (a *RepositoriesApiService) PostV5ReposOwnerRepoContentsPath(ctx context.Co
if localVarHttpHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
}
- if localVarOptionals != nil && localVarOptionals.AccessToken.IsSet() {
- localVarFormParams.Add("access_token", parameterToString(localVarOptionals.AccessToken.Value(), ""))
- }
- localVarFormParams.Add("content", parameterToString(content, ""))
- localVarFormParams.Add("message", parameterToString(message, ""))
- if localVarOptionals != nil && localVarOptionals.Branch.IsSet() {
- localVarFormParams.Add("branch", parameterToString(localVarOptionals.Branch.Value(), ""))
- }
- if localVarOptionals != nil && localVarOptionals.CommitterName.IsSet() {
- localVarFormParams.Add("committer[name]", parameterToString(localVarOptionals.CommitterName.Value(), ""))
- }
- if localVarOptionals != nil && localVarOptionals.CommitterEmail.IsSet() {
- localVarFormParams.Add("committer[email]", parameterToString(localVarOptionals.CommitterEmail.Value(), ""))
- }
- if localVarOptionals != nil && localVarOptionals.AuthorName.IsSet() {
- localVarFormParams.Add("author[name]", parameterToString(localVarOptionals.AuthorName.Value(), ""))
- }
- if localVarOptionals != nil && localVarOptionals.AuthorEmail.IsSet() {
- localVarFormParams.Add("author[email]", parameterToString(localVarOptionals.AuthorEmail.Value(), ""))
- }
+ // body params
+ localVarPostBody = &body
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
if err != nil {
return localVarReturnValue, nil, err
diff --git a/vendor/gitee.com/openeuler/go-gitee/gitee/hook_event_types.go b/vendor/gitee.com/openeuler/go-gitee/gitee/hook_event_types.go
index 1081a7528a87690c71b42885b9296c3ad9e1df22..2a12e7fbb327278a4559e70a98028a5b91bf5e21 100644
--- a/vendor/gitee.com/openeuler/go-gitee/gitee/hook_event_types.go
+++ b/vendor/gitee.com/openeuler/go-gitee/gitee/hook_event_types.go
@@ -82,9 +82,9 @@ type PullRequestEvent struct {
MergeCommitSha *string `json:"merge_commit_sha,omitempty"`
URL *string `json:"url,omitempty"`
SourceBranch *string `json:"source_branch,omitempty"`
- SourceRepo *ProjectHook `json:"source_repo,omitempty"`
+ SourceRepo *RepoInfo `json:"source_repo,omitempty"`
TargetBranch *string `json:"target_branch,omitempty"`
- TargetRepo *ProjectHook `json:"target_repo,omitempty"`
+ TargetRepo *RepoInfo `json:"target_repo,omitempty"`
Project *ProjectHook `json:"project,omitempty"`
Repository *ProjectHook `json:"repository,omitempty"`
Author *UserHook `json:"author,omitempty"`
diff --git a/vendor/gitee.com/openeuler/go-gitee/gitee/model_branch.go b/vendor/gitee.com/openeuler/go-gitee/gitee/model_branch.go
index 98b8e66aa1db0db826632d540d57b885545ebaea..926af4d01cf8b634323f9e566fdcbb5363cdf87d 100644
--- a/vendor/gitee.com/openeuler/go-gitee/gitee/model_branch.go
+++ b/vendor/gitee.com/openeuler/go-gitee/gitee/model_branch.go
@@ -11,8 +11,8 @@ package gitee
// 获取所有分支
type Branch struct {
- Name string `json:"name,omitempty"`
- Commit string `json:"commit,omitempty"`
- Protected string `json:"protected,omitempty"`
- ProtectionUrl string `json:"protection_url,omitempty"`
+ Name string `json:"name,omitempty"`
+ Commit *BranchCommit `json:"commit,omitempty"`
+ Protected bool `json:"protected,omitempty"`
+ ProtectionUrl string `json:"protection_url,omitempty"`
}
diff --git a/vendor/gitee.com/openeuler/go-gitee/gitee/model_branch_commit.go b/vendor/gitee.com/openeuler/go-gitee/gitee/model_branch_commit.go
new file mode 100644
index 0000000000000000000000000000000000000000..247a83600896128be9a80b44bea1c560841f7465
--- /dev/null
+++ b/vendor/gitee.com/openeuler/go-gitee/gitee/model_branch_commit.go
@@ -0,0 +1,16 @@
+/*
+ * 码云 Open API
+ *
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
+ *
+ * API version: 5.3.2
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
+ */
+
+package gitee
+
+// 分支commit info
+type BranchCommit struct {
+ Url string `json:"url,omitempty"`
+ Sha string `json:"sha,omitempty"`
+}
diff --git a/vendor/gitee.com/openeuler/go-gitee/gitee/model_complete_branch.go b/vendor/gitee.com/openeuler/go-gitee/gitee/model_complete_branch.go
index df48bc0e39dca007e5d6516d689ab647e55f49b3..bbe31f047423d208080ba564ec372634bbfbe0fc 100644
--- a/vendor/gitee.com/openeuler/go-gitee/gitee/model_complete_branch.go
+++ b/vendor/gitee.com/openeuler/go-gitee/gitee/model_complete_branch.go
@@ -12,7 +12,7 @@ package gitee
// 创建分支
type CompleteBranch struct {
Name string `json:"name,omitempty"`
- Commit string `json:"commit,omitempty"`
+ Commit *BranchCommit `json:"commit,omitempty"`
Links string `json:"_links,omitempty"`
Protected string `json:"protected,omitempty"`
ProtectionUrl string `json:"protection_url,omitempty"`
diff --git a/vendor/gitee.com/openeuler/go-gitee/gitee/model_create_pull_request_param.go b/vendor/gitee.com/openeuler/go-gitee/gitee/model_create_pull_request_param.go
new file mode 100644
index 0000000000000000000000000000000000000000..a87c795b45de1662d9d337df14ffc053a53bf4ca
--- /dev/null
+++ b/vendor/gitee.com/openeuler/go-gitee/gitee/model_create_pull_request_param.go
@@ -0,0 +1,35 @@
+/*
+ * 码云 Open API
+ *
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
+ *
+ * API version: 5.3.2
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
+ */
+
+package gitee
+
+type CreatePullRequestParam struct {
+ // 用户授权码
+ AccessToken string `json:"access_token,omitempty"`
+ // 必填。Pull Request 标题
+ Title string `json:"title,omitempty"`
+ // 必填。Pull Request 提交的源分支。格式:branch 或者:username:branch
+ Head string `json:"head,omitempty"`
+ // 必填。Pull Request 提交目标分支的名称
+ Base string `json:"base,omitempty"`
+ // 可选。Pull Request 内容
+ Body string `json:"body,omitempty"`
+ // 可选。里程碑序号(id)
+ MilestoneNumber int32 `json:"milestone_number,omitempty"`
+ // 用逗号分开的标签,名称要求长度在 2-20 之间且非特殊字符。如: bug,performance
+ Labels string `json:"labels,omitempty"`
+ // 可选。Pull Request的标题和内容可以根据指定的Issue Id自动填充
+ Issue string `json:"issue,omitempty"`
+ // 可选。审查人员username,可多个,半角逗号分隔,如:(username1,username2)
+ Assignees string `json:"assignees,omitempty"`
+ // 可选。测试人员username,可多个,半角逗号分隔,如:(username1,username2)
+ Testers string `json:"testers,omitempty"`
+ // 可选。合并PR后是否删除源分支,默认false(不删除)
+ PruneSourceBranch bool `json:"prune_source_branch,omitempty"`
+}
diff --git a/vendor/gitee.com/openeuler/go-gitee/gitee/model_new_file_param.go b/vendor/gitee.com/openeuler/go-gitee/gitee/model_new_file_param.go
new file mode 100644
index 0000000000000000000000000000000000000000..2beb12983c778f8b76e579e652dd5a07c7bafaad
--- /dev/null
+++ b/vendor/gitee.com/openeuler/go-gitee/gitee/model_new_file_param.go
@@ -0,0 +1,29 @@
+/*
+ * 码云 Open API
+ *
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
+ *
+ * API version: 5.3.2
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
+ */
+
+package gitee
+
+type NewFileParam struct {
+ // 用户授权码
+ AccessToken string `json:"access_token,omitempty"`
+ // 文件内容, 要用 base64 编码
+ Content string `json:"content,omitempty"`
+ // 提交信息
+ Message string `json:"message,omitempty"`
+ // 分支名称。默认为仓库对默认分支
+ Branch string `json:"branch,omitempty"`
+ // Committer的名字,默认为当前用户的名字
+ CommitterName string `json:"committer[name],omitempty"`
+ // Committer的邮箱,默认为当前用户的邮箱
+ CommitterEmail string `json:"committer[email],omitempty"`
+ // Author的名字,默认为当前用户的名字
+ AuthorName string `json:"author[name],omitempty"`
+ // Author的邮箱,默认为当前用户的邮箱
+ AuthorEmail string `json:"author[email],omitempty"`
+}
diff --git a/vendor/gitee.com/openeuler/go-gitee/gitee/model_pull_request_assignee_post_param.go b/vendor/gitee.com/openeuler/go-gitee/gitee/model_pull_request_assignee_post_param.go
new file mode 100644
index 0000000000000000000000000000000000000000..95dddda1a3d5b3c5c2d5924bd44d554c3c6eaeb1
--- /dev/null
+++ b/vendor/gitee.com/openeuler/go-gitee/gitee/model_pull_request_assignee_post_param.go
@@ -0,0 +1,18 @@
+/*
+ * 码云 Open API
+ *
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
+ *
+ * API version: 5.3.2
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
+ */
+
+package gitee
+
+// assign pull request
+type PullRequestAssigneePostParam struct {
+ // 用户授权码
+ AccessToken string `json:"access_token,omitempty"`
+ // 用户的个人空间地址, 以 , 分隔
+ Assignees string `json:"assignees,omitempty"`
+}
diff --git a/vendor/gitee.com/openeuler/go-gitee/gitee/model_pull_request_comments.go b/vendor/gitee.com/openeuler/go-gitee/gitee/model_pull_request_comments.go
index 546e0e92de630ef1a7e9bf6173f795d1732aba33..f2ddf4512beb018b5d2367f63e117ab96d20da7b 100644
--- a/vendor/gitee.com/openeuler/go-gitee/gitee/model_pull_request_comments.go
+++ b/vendor/gitee.com/openeuler/go-gitee/gitee/model_pull_request_comments.go
@@ -12,7 +12,7 @@ package gitee
// 编辑评论
type PullRequestComments struct {
Url string `json:"url,omitempty"`
- Id string `json:"id,omitempty"`
+ Id int32 `json:"id,omitempty"`
Path string `json:"path,omitempty"`
Position string `json:"position,omitempty"`
OriginalPosition string `json:"original_position,omitempty"`
diff --git a/vendor/gitee.com/openeuler/go-gitee/gitee/model_pull_request_file_path.go b/vendor/gitee.com/openeuler/go-gitee/gitee/model_pull_request_file_path.go
new file mode 100644
index 0000000000000000000000000000000000000000..33b69265079597ae66c8c0988b84923ee6174238
--- /dev/null
+++ b/vendor/gitee.com/openeuler/go-gitee/gitee/model_pull_request_file_path.go
@@ -0,0 +1,23 @@
+/*
+ * 码云 Open API
+ *
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
+ *
+ * API version: 5.3.2
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
+ */
+
+package gitee
+
+// 单个文件的patch信息
+type PullRequestFilePath struct {
+ Diff string `json:"diff,omitempty"`
+ NewPath string `json:"new_path,omitempty"`
+ OldPath string `json:"old_path,omitempty"`
+ AMode string `json:"a_mode,omitempty"`
+ BMode string `json:"b_mode,omitempty"`
+ NewFile bool `json:"new_file,omitempty"`
+ RenamedFile bool `json:"renamed_file,omitempty"`
+ DeletedFile bool `json:"deleted_file,omitempty"`
+ TooLarge bool `json:"too_large,omitempty"`
+}
diff --git a/vendor/gitee.com/openeuler/go-gitee/gitee/model_pull_request_files.go b/vendor/gitee.com/openeuler/go-gitee/gitee/model_pull_request_files.go
index 538698f9b0e0644ac70ee706985c8ea43df7d69d..bff3c4e22a956b5b865b34b43725af0d9b8b5a80 100644
--- a/vendor/gitee.com/openeuler/go-gitee/gitee/model_pull_request_files.go
+++ b/vendor/gitee.com/openeuler/go-gitee/gitee/model_pull_request_files.go
@@ -11,12 +11,12 @@ package gitee
// Pull Request Commit文件列表。最多显示300条diff
type PullRequestFiles struct {
- Sha string `json:"sha,omitempty"`
- Filename string `json:"filename,omitempty"`
- Status string `json:"status,omitempty"`
- Additions string `json:"additions,omitempty"`
- Deletions string `json:"deletions,omitempty"`
- BlobUrl string `json:"blob_url,omitempty"`
- RawUrl string `json:"raw_url,omitempty"`
- Patch string `json:"patch,omitempty"`
+ Sha string `json:"sha,omitempty"`
+ Filename string `json:"filename,omitempty"`
+ Status string `json:"status,omitempty"`
+ Additions string `json:"additions,omitempty"`
+ Deletions string `json:"deletions,omitempty"`
+ BlobUrl string `json:"blob_url,omitempty"`
+ RawUrl string `json:"raw_url,omitempty"`
+ Patch *PullRequestFilePath `json:"patch,omitempty"`
}
diff --git a/vendor/gitee.com/openeuler/go-gitee/gitee/model_pull_request_label_post_param.go b/vendor/gitee.com/openeuler/go-gitee/gitee/model_pull_request_label_post_param.go
new file mode 100644
index 0000000000000000000000000000000000000000..85fd3f2f2fcc6697f50147dc2ad4760ff14a764a
--- /dev/null
+++ b/vendor/gitee.com/openeuler/go-gitee/gitee/model_pull_request_label_post_param.go
@@ -0,0 +1,18 @@
+/*
+ * 码云 Open API
+ *
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
+ *
+ * API version: 5.3.2
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
+ */
+
+package gitee
+
+// create pull request label
+type PullRequestLabelPostParam struct {
+ // 用户授权码
+ AccessToken string `json:"access_token,omitempty"`
+ // 标签名数组,如: [\"feat\", \"bug\"]
+ Body []string `json:"body,omitempty"`
+}
diff --git a/vendor/modules.txt b/vendor/modules.txt
index ca28922e6442e4da4bff5424f288c8adf5fd78e8..99412ab49f6dca3e41144c614b33629d14944a19 100644
--- a/vendor/modules.txt
+++ b/vendor/modules.txt
@@ -1,4 +1,4 @@
-# gitee.com/openeuler/go-gitee v0.0.0-20200320051710-5687412fb922
+# gitee.com/openeuler/go-gitee v0.0.0-20200424023021-ced5a4d67179
gitee.com/openeuler/go-gitee/gitee
# github.com/antihax/optional v1.0.0
github.com/antihax/optional