diff --git a/commands/pull_request.go b/commands/pull_request.go index bf84193f8389c9e558f309481342353dd46f9f28..6756368e297ab4f224c798c42f2c500dadbfedd9 100644 --- a/commands/pull_request.go +++ b/commands/pull_request.go @@ -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) } } diff --git a/features/pull_request.feature b/features/pull_request.feature index eba7c7b06ca294e0d6098cea88a75d8827460089..00b4e3cf4e04b4e6f0185f2cb6e135a20f132bd9 100644 --- a/features/pull_request.feature +++ b/features/pull_request.feature @@ -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 diff --git a/github/http.go b/github/http.go index 3aee451e943dc8812343ccf1fc0045af6dff36e8..faf7e97ffe6a694e1fbfff381a354d73b9f6c064 100644 --- a/github/http.go +++ b/github/http.go @@ -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") }) }