MCPcopy
hub / github.com/mislav/hub / CreatePullRequest

Method CreatePullRequest

github/client.go:128–147  ·  view source on GitHub ↗
(project *Project, params map[string]interface{})

Source from the content-addressed store, hash-verified

126}
127
128func (client *Client) CreatePullRequest(project *Project, params map[string]interface{}) (pr *PullRequest, err error) {
129 api, err := client.simpleApi()
130 if err != nil {
131 return
132 }
133
134 res, err := api.PostJSONPreview(fmt.Sprintf("repos/%s/%s/pulls", project.Owner, project.Name), params, draftsType)
135 if err = checkStatus(201, "creating pull request", res, err); err != nil {
136 if res != nil && res.StatusCode == 404 {
137 projectUrl := strings.SplitN(project.WebURL("", "", ""), "://", 2)[1]
138 err = fmt.Errorf("%s\nAre you sure that %s exists?", err, projectUrl)
139 }
140 return
141 }
142
143 pr = &PullRequest{}
144 err = res.Unmarshal(pr)
145
146 return
147}
148
149func (client *Client) RequestReview(project *Project, prNumber int, params map[string]interface{}) (err error) {
150 api, err := client.simpleApi()

Callers 1

pullRequestFunction · 0.80

Calls 6

simpleApiMethod · 0.95
checkStatusFunction · 0.85
PostJSONPreviewMethod · 0.80
WebURLMethod · 0.80
UnmarshalMethod · 0.80
ErrorfMethod · 0.65

Tested by

no test coverage detected