未验证 提交 0ebd0fca 编写于 作者: M Mislav Marohnić 提交者: GitHub

Merge pull request #1652 from github/team-reviewers

Enable team reviewers in `pull-request`
......@@ -336,7 +336,19 @@ func pullRequest(cmd *Command, args *Args) {
}
if len(flagPullRequestReviewers) > 0 {
err = client.RequestReview(baseProject, pr.Number, map[string]interface{}{"reviewers": flagPullRequestReviewers})
userReviewers := []string{}
teamReviewers := []string{}
for _, reviewer := range flagPullRequestReviewers {
if strings.Contains(reviewer, "/") {
teamReviewers = append(teamReviewers, strings.SplitN(reviewer, "/", 2)[1])
} else {
userReviewers = append(userReviewers, reviewer)
}
}
err = client.RequestReview(baseProject, pr.Number, map[string]interface{}{
"reviewers": userReviewers,
"team_reviewers": teamReviewers,
})
utils.Check(err)
}
}
......
......@@ -743,13 +743,14 @@ BODY
json :html_url => "the://url", :number => 1234
}
post('/repos/mislav/coral/pulls/1234/requested_reviewers') {
halt 415 unless request.accept?('application/vnd.github.black-cat-preview+json')
halt 415 unless request.accept?('application/vnd.github.thor-preview+json')
assert :reviewers => ["mislav", "josh", "pcorpet"]
assert :team_reviewers => ["robots", "js"]
status 201
json :html_url => "the://url"
}
"""
When I successfully run `hub pull-request -m hereyougo -r mislav,josh -rpcorpet`
When I successfully run `hub pull-request -m hereyougo -r mislav,josh -rgithub/robots -rpcorpet -r github/js`
Then the output should contain exactly "the://url\n"
Scenario: Pull request with milestone
......
......@@ -276,7 +276,7 @@ func (c *simpleClient) PatchJSON(path string, payload interface{}) (*simpleRespo
func (c *simpleClient) PostReview(path string, payload interface{}) (*simpleResponse, error) {
return c.jsonRequest("POST", path, payload, func(req *http.Request) {
req.Header.Set("Accept", "application/vnd.github.black-cat-preview+json;charset=utf-8")
req.Header.Set("Accept", "application/vnd.github.thor-preview+json;charset=utf-8")
})
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册