{"action":"created","comment":{"url":"https://api.github.com/repos/choerodon/cibase/pulls/comments/190249782","pull_request_review_id":122587427,"id":190249782,"diff_hunk":"@@ -167,51 +93,113 @@ func InitData() {\n \tCheckErr(err)\n \tgitLog, err := gitLogs.Next()\n \tCheckErr(err)\n-\tCiCommitTime = gitLog.Committer.When.Format(\"20060102150405\")\n+\tciCommitTime = gitLog.Committer.When.Format(\"20060102150405\")\n }\n \n-func GetReleaseOrHotfixBranchVersion() string {\n-\tmatch, err := regexp.MatchString(`^releases?[/-](\\d+(\\.\\d+){1,2}).*`, CiCommitRefName)\n+func GetMaxSubVersion(cur, max string) int {\n+\tiCur, err := strconv.Atoi(cur)\n \tCheckErr(err)\n-\tif match {\n+\tiMax, err := strconv.Atoi(max)\n+\tCheckErr(err)\n+\tif iCur > iMax {\n+\t\treturn 1\n+\t} else if iCur == iMax {\n+\t\treturn 0\n+\t}\n+\treturn -1\n+}\n+\n+func GetMaxVersion(cur, max string) string {\n+\tflag := GetMaxSubVersion(strings.Split(cur, \".\")[0], strings.Split(max, \".\")[0])\n+\tif flag == 1 {\n+\t\treturn cur\n+\t} else if flag == -1 {\n+\t\treturn max\n+\t} else {\n+\t\tflag = GetMaxSubVersion(strings.Split(cur, \".\")[1], strings.Split(max, \".\")[1])\n+\t\tif flag == -1 {\n+\t\t\treturn max\n+\t\t} else {\n+\t\t\treturn cur\n+\t\t}\n+\t}\n+}\n+\n+func GetMaxBranchVersion() string {\n+\tmaxBranchVersion := \"0.0.0\"\n+\tif len(branches) == 0 {\n+\t\treturn maxBranchVersion\n+\t}\n+\tfor _, b := range branches {\n+\t\tmatch, err := regexp.MatchString(`^releases?[/-](\\d+(\\.\\d+){1,2}).*`, b)\n+\t\tCheckErr(err)\n+\t\tif !match {\n+\t\t\tcontinue\n+\t\t}\n \t\tr, err := regexp.Compile(`^releases?[/-](\\d+(\\.\\d+){1,2}).*`)\n \t\tCheckErr(err)\n-\t\tReleaseBranchVersion := r.FindStringSubmatch(CiCommitRefName)[1]\n-\t\treturn fmt.Sprintf(\"%s-rc.%s\", ReleaseBranchVersion, CiCommitTime)\n+\t\tCurBranch := r.FindStringSubmatch(b)[1]","path":"main.go","position":191,"original_position":191,"commit_id":"6b9058d615522156293445f525ca8a7d207ad600","original_commit_id":"6b9058d615522156293445f525ca8a7d207ad600","user":{"login":"vinkdong","id":10599904,"avatar_url":"https://avatars0.githubusercontent.com/u/10599904?v=4","gravatar_id":"","url":"https://api.github.com/users/vinkdong","html_url":"https://github.com/vinkdong","followers_url":"https://api.github.com/users/vinkdong/followers","following_url":"https://api.github.com/users/vinkdong/following{/other_user}","gists_url":"https://api.github.com/users/vinkdong/gists{/gist_id}","starred_url":"https://api.github.com/users/vinkdong/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vinkdong/subscriptions","organizations_url":"https://api.github.com/users/vinkdong/orgs","repos_url":"https://api.github.com/users/vinkdong/repos","events_url":"https://api.github.com/users/vinkdong/events{/privacy}","received_events_url":"https://api.github.com/users/vinkdong/received_events","type":"User","site_admin":false},"body":"Camel-Case","created_at":"2018-05-23T13:40:56Z","updated_at":"2018-05-23T13:47:51Z","html_url":"https://github.com/choerodon/cibase/pull/3#discussion_r190249782","pull_request_url":"https://api.github.com/repos/choerodon/cibase/pulls/3","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/choerodon/cibase/pulls/comments/190249782"},"html":{"href":"https://github.com/choerodon/cibase/pull/3#discussion_r190249782"},"pull_request":{"href":"https://api.github.com/repos/choerodon/cibase/pulls/3"}}},"pull_request":{"url":"https://api.github.com/repos/choerodon/cibase/pulls/3","id":189976557,"html_url":"https://github.com/choerodon/cibase/pull/3","diff_url":"https://github.com/choerodon/cibase/pull/3.diff","patch_url":"https://github.com/choerodon/cibase/pull/3.patch","issue_url":"https://api.github.com/repos/choerodon/cibase/issues/3","number":3,"state":"open","locked":false,"title":"[FIX]修复版本比较取最大值错误问题","user":{"login":"TimeBye","id":22651579,"avatar_url":"https://avatars2.githubusercontent.com/u/22651579?v=4","gravatar_id":"","url":"https://api.github.com/users/TimeBye","html_url":"https://github.com/TimeBye","followers_url":"https://api.github.com/users/TimeBye/followers","following_url":"https://api.github.com/users/TimeBye/following{/other_user}","gists_url":"https://api.github.com/users/TimeBye/gists{/gist_id}","starred_url":"https://api.github.com/users/TimeBye/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TimeBye/subscriptions","organizations_url":"https://api.github.com/users/TimeBye/orgs","repos_url":"https://api.github.com/users/TimeBye/repos","events_url":"https://api.github.com/users/TimeBye/events{/privacy}","received_events_url":"https://api.github.com/users/TimeBye/received_events","type":"User","site_admin":false},"body":"修复版本比较取最大值错误问题\r\n\r\nFixes #2 ","created_at":"2018-05-23T13:32:28Z","updated_at":"2018-05-23T13:47:51Z","closed_at":null,"merged_at":null,"merge_commit_sha":"32540a0ec3bc0b2cfa9cb0aab39944b6ab9e7584","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/choerodon/cibase/pulls/3/commits","review_comments_url":"https://api.github.com/repos/choerodon/cibase/pulls/3/comments","review_comment_url":"https://api.github.com/repos/choerodon/cibase/pulls/comments{/number}","comments_url":"https://api.github.com/repos/choerodon/cibase/issues/3/comments","statuses_url":"https://api.github.com/repos/choerodon/cibase/statuses/6b9058d615522156293445f525ca8a7d207ad600","head":{"label":"TimeBye:master","ref":"master","sha":"6b9058d615522156293445f525ca8a7d207ad600","user":{"login":"TimeBye","id":22651579,"avatar_url":"https://avatars2.githubusercontent.com/u/22651579?v=4","gravatar_id":"","url":"https://api.github.com/users/TimeBye","html_url":"https://github.com/TimeBye","followers_url":"https://api.github.com/users/TimeBye/followers","following_url":"https://api.github.com/users/TimeBye/following{/other_user}","gists_url":"https://api.github.com/users/TimeBye/gists{/gist_id}","starred_url":"https://api.github.com/users/TimeBye/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TimeBye/subscriptions","organizations_url":"https://api.github.com/users/TimeBye/orgs","repos_url":"https://api.github.com/users/TimeBye/repos","events_url":"https://api.github.com/users/TimeBye/events{/privacy}","received_events_url":"https://api.github.com/users/TimeBye/received_events","type":"User","site_admin":false},"repo":{"id":134497472,"name":"cibase","full_name":"TimeBye/cibase","owner":{"login":"TimeBye","id":22651579,"avatar_url":"https://avatars2.githubusercontent.com/u/22651579?v=4","gravatar_id":"","url":"https://api.github.com/users/TimeBye","html_url":"https://github.com/TimeBye","followers_url":"https://api.github.com/users/TimeBye/followers","following_url":"https://api.github.com/users/TimeBye/following{/other_user}","gists_url":"https://api.github.com/users/TimeBye/gists{/gist_id}","starred_url":"https://api.github.com/users/TimeBye/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TimeBye/subscriptions","organizations_url":"https://api.github.com/users/TimeBye/orgs","repos_url":"https://api.github.com/users/TimeBye/repos","events_url":"https://api.github.com/users/TimeBye/events{/privacy}","received_events_url":"https://api.github.com/users/TimeBye/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/TimeBye/cibase","description":null,"fork":true,"url":"https://api.github.com/repos/TimeBye/cibase","forks_url":"https://api.github.com/repos/TimeBye/cibase/forks","keys_url":"https://api.github.com/repos/TimeBye/cibase/keys{/key_id}","collaborators_url":"https://api.github.com/repos/TimeBye/cibase/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/TimeBye/cibase/teams","hooks_url":"https://api.github.com/repos/TimeBye/cibase/hooks","issue_events_url":"https://api.github.com/repos/TimeBye/cibase/issues/events{/number}","events_url":"https://api.github.com/repos/TimeBye/cibase/events","assignees_url":"https://api.github.com/repos/TimeBye/cibase/assignees{/user}","branches_url":"https://api.github.com/repos/TimeBye/cibase/branches{/branch}","tags_url":"https://api.github.com/repos/TimeBye/cibase/tags","blobs_url":"https://api.github.com/repos/TimeBye/cibase/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/TimeBye/cibase/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/TimeBye/cibase/git/refs{/sha}","trees_url":"https://api.github.com/repos/TimeBye/cibase/git/trees{/sha}","statuses_url":"https://api.github.com/repos/TimeBye/cibase/statuses/{sha}","languages_url":"https://api.github.com/repos/TimeBye/cibase/languages","stargazers_url":"https://api.github.com/repos/TimeBye/cibase/stargazers","contributors_url":"https://api.github.com/repos/TimeBye/cibase/contributors","subscribers_url":"https://api.github.com/repos/TimeBye/cibase/subscribers","subscription_url":"https://api.github.com/repos/TimeBye/cibase/subscription","commits_url":"https://api.github.com/repos/TimeBye/cibase/commits{/sha}","git_commits_url":"https://api.github.com/repos/TimeBye/cibase/git/commits{/sha}","comments_url":"https://api.github.com/repos/TimeBye/cibase/comments{/number}","issue_comment_url":"https://api.github.com/repos/TimeBye/cibase/issues/comments{/number}","contents_url":"https://api.github.com/repos/TimeBye/cibase/contents/{+path}","compare_url":"https://api.github.com/repos/TimeBye/cibase/compare/{base}...{head}","merges_url":"https://api.github.com/repos/TimeBye/cibase/merges","archive_url":"https://api.github.com/repos/TimeBye/cibase/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/TimeBye/cibase/downloads","issues_url":"https://api.github.com/repos/TimeBye/cibase/issues{/number}","pulls_url":"https://api.github.com/repos/TimeBye/cibase/pulls{/number}","milestones_url":"https://api.github.com/repos/TimeBye/cibase/milestones{/number}","notifications_url":"https://api.github.com/repos/TimeBye/cibase/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/TimeBye/cibase/labels{/name}","releases_url":"https://api.github.com/repos/TimeBye/cibase/releases{/id}","deployments_url":"https://api.github.com/repos/TimeBye/cibase/deployments","created_at":"2018-05-23T01:49:14Z","updated_at":"2018-05-23T13:31:33Z","pushed_at":"2018-05-23T13:31:32Z","git_url":"git://github.com/TimeBye/cibase.git","ssh_url":"git@github.com:TimeBye/cibase.git","clone_url":"https://github.com/TimeBye/cibase.git","svn_url":"https://github.com/TimeBye/cibase","homepage":null,"size":816,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":null,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"choerodon:master","ref":"master","sha":"d3a52e42761ce94fde0e75d65cd45635797d5295","user":{"login":"choerodon","id":35286639,"avatar_url":"https://avatars1.githubusercontent.com/u/35286639?v=4","gravatar_id":"","url":"https://api.github.com/users/choerodon","html_url":"https://github.com/choerodon","followers_url":"https://api.github.com/users/choerodon/followers","following_url":"https://api.github.com/users/choerodon/following{/other_user}","gists_url":"https://api.github.com/users/choerodon/gists{/gist_id}","starred_url":"https://api.github.com/users/choerodon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/choerodon/subscriptions","organizations_url":"https://api.github.com/users/choerodon/orgs","repos_url":"https://api.github.com/users/choerodon/repos","events_url":"https://api.github.com/users/choerodon/events{/privacy}","received_events_url":"https://api.github.com/users/choerodon/received_events","type":"Organization","site_admin":false},"repo":{"id":133942506,"name":"cibase","full_name":"choerodon/cibase","owner":{"login":"choerodon","id":35286639,"avatar_url":"https://avatars1.githubusercontent.com/u/35286639?v=4","gravatar_id":"","url":"https://api.github.com/users/choerodon","html_url":"https://github.com/choerodon","followers_url":"https://api.github.com/users/choerodon/followers","following_url":"https://api.github.com/users/choerodon/following{/other_user}","gists_url":"https://api.github.com/users/choerodon/gists{/gist_id}","starred_url":"https://api.github.com/users/choerodon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/choerodon/subscriptions","organizations_url":"https://api.github.com/users/choerodon/orgs","repos_url":"https://api.github.com/users/choerodon/repos","events_url":"https://api.github.com/users/choerodon/events{/privacy}","received_events_url":"https://api.github.com/users/choerodon/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/choerodon/cibase","description":null,"fork":false,"url":"https://api.github.com/repos/choerodon/cibase","forks_url":"https://api.github.com/repos/choerodon/cibase/forks","keys_url":"https://api.github.com/repos/choerodon/cibase/keys{/key_id}","collaborators_url":"https://api.github.com/repos/choerodon/cibase/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/choerodon/cibase/teams","hooks_url":"https://api.github.com/repos/choerodon/cibase/hooks","issue_events_url":"https://api.github.com/repos/choerodon/cibase/issues/events{/number}","events_url":"https://api.github.com/repos/choerodon/cibase/events","assignees_url":"https://api.github.com/repos/choerodon/cibase/assignees{/user}","branches_url":"https://api.github.com/repos/choerodon/cibase/branches{/branch}","tags_url":"https://api.github.com/repos/choerodon/cibase/tags","blobs_url":"https://api.github.com/repos/choerodon/cibase/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/choerodon/cibase/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/choerodon/cibase/git/refs{/sha}","trees_url":"https://api.github.com/repos/choerodon/cibase/git/trees{/sha}","statuses_url":"https://api.github.com/repos/choerodon/cibase/statuses/{sha}","languages_url":"https://api.github.com/repos/choerodon/cibase/languages","stargazers_url":"https://api.github.com/repos/choerodon/cibase/stargazers","contributors_url":"https://api.github.com/repos/choerodon/cibase/contributors","subscribers_url":"https://api.github.com/repos/choerodon/cibase/subscribers","subscription_url":"https://api.github.com/repos/choerodon/cibase/subscription","commits_url":"https://api.github.com/repos/choerodon/cibase/commits{/sha}","git_commits_url":"https://api.github.com/repos/choerodon/cibase/git/commits{/sha}","comments_url":"https://api.github.com/repos/choerodon/cibase/comments{/number}","issue_comment_url":"https://api.github.com/repos/choerodon/cibase/issues/comments{/number}","contents_url":"https://api.github.com/repos/choerodon/cibase/contents/{+path}","compare_url":"https://api.github.com/repos/choerodon/cibase/compare/{base}...{head}","merges_url":"https://api.github.com/repos/choerodon/cibase/merges","archive_url":"https://api.github.com/repos/choerodon/cibase/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/choerodon/cibase/downloads","issues_url":"https://api.github.com/repos/choerodon/cibase/issues{/number}","pulls_url":"https://api.github.com/repos/choerodon/cibase/pulls{/number}","milestones_url":"https://api.github.com/repos/choerodon/cibase/milestones{/number}","notifications_url":"https://api.github.com/repos/choerodon/cibase/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/choerodon/cibase/labels{/name}","releases_url":"https://api.github.com/repos/choerodon/cibase/releases{/id}","deployments_url":"https://api.github.com/repos/choerodon/cibase/deployments","created_at":"2018-05-18T10:54:28Z","updated_at":"2018-05-23T01:48:46Z","pushed_at":"2018-05-23T13:32:29Z","git_url":"git://github.com/choerodon/cibase.git","ssh_url":"git@github.com:choerodon/cibase.git","clone_url":"https://github.com/choerodon/cibase.git","svn_url":"https://github.com/choerodon/cibase","homepage":null,"size":815,"stargazers_count":4,"watchers_count":4,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"archived":false,"open_issues_count":1,"license":null,"forks":2,"open_issues":1,"watchers":4,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/choerodon/cibase/pulls/3"},"html":{"href":"https://github.com/choerodon/cibase/pull/3"},"issue":{"href":"https://api.github.com/repos/choerodon/cibase/issues/3"},"comments":{"href":"https://api.github.com/repos/choerodon/cibase/issues/3/comments"},"review_comments":{"href":"https://api.github.com/repos/choerodon/cibase/pulls/3/comments"},"review_comment":{"href":"https://api.github.com/repos/choerodon/cibase/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/choerodon/cibase/pulls/3/commits"},"statuses":{"href":"https://api.github.com/repos/choerodon/cibase/statuses/6b9058d615522156293445f525ca8a7d207ad600"}},"author_association":"NONE"}}
{"actor":{"display_login":"vinkdong"}}