prow/github/client.go
func (c *Client) UpdatePullRequest(org, repo string, number int, title, body *string, open *bool, branch *string, canModify *bool) error {
	c.log("UpdatePullRequest", org, repo, title)
	data := struct {
		State *string `json:"state,omitempty"`
		Title *string `json:"title,omitempty"`
		Body  *string `json:"body,omitempty"`
		Base  *string `json:"base,omitempty"`
		// MaintainerCanModify allows maintainers of the repo to modify this
		// pull request, eg. push changes to it before merging.
		MaintainerCanModify *bool `json:"maintainer_can_modify,omitempty"`
	}{
		Title:               title,
		Body:                body,
		Base:                branch,
		MaintainerCanModify: canModify,
	}
	if open != nil && *open {
		op := "open"
		data.State = &op
	} else if open != nil {
		cl := "clossed"
		data.State = &cl
	}
	_, err := c.request(&request{
		// allow the description and draft fields
		// https://developer.github.com/changes/2018-02-22-label-description-search-preview/
		// https://developer.github.com/changes/2019-02-14-draft-pull-requests/
		accept:      "application/vnd.github.symmetra-preview+json, application/vnd.github.shadow-cat-preview",
		method:      http.MethodPatch,
		path:        fmt.Sprintf("/repos/%s/%s/pulls/%d", org, repo, number),
		requestBody: &data,
		exitCodes:   []int{200},
	}, nil)
	return err
}
func (c *Client) UpdatePullRequest(org, repo string, number int, title, body *string, open *bool, branch *string, canModify *bool) error {
	c.log("UpdatePullRequest", org, repo, title)
	data := struct {
		State *string `json:"state,omitempty"`
		Title *string `json:"title,omitempty"`
		Body  *string `json:"body,omitempty"`
		Base  *string `json:"base,omitempty"`
		// MaintainerCanModify allows maintainers of the repo to modify this
		// pull request, eg. push changes to it before merging.
		MaintainerCanModify *bool `json:"maintainer_can_modify,omitempty"`
	}{
		Title:               title,
		Body:                body,
		Base:                branch,
		MaintainerCanModify: canModify,
	}
	if open != nil && *open {
		op := "open"
		data.State = &op
	} else if open != nil {
		cl := "clossed"
		data.State = &cl
	}
	_, err := c.request(&request{
		// allow the description and draft fields
		// https://developer.github.com/changes/2018-02-22-label-description-search-preview/
		// https://developer.github.com/changes/2019-02-14-draft-pull-requests/
		accept:      "application/vnd.github.symmetra-preview+json, application/vnd.github.shadow-cat-preview",
		method:      http.MethodPatch,
		path:        fmt.Sprintf("/repos/%s/%s/pulls/%d", org, repo, number),
		requestBody: &data,
		exitCodes:   []int{200},
	}, nil)
	return err
}
func ( c * Client ) UpdatePullRequest ( org , repo string , number int , title , body * string , open * bool , branch * string , canModify * bool ) error { c . log ( " " , org , repo , title ) data := struct { State * string `json:"state,omitempty"` Title * string `json:"title,omitempty"` Body * string `json:"body,omitempty"` Base * string `json:"base,omitempty"` // MaintainerCanModify allows maintainers of the repo to modify this // pull request, eg. push changes to it before merging. MaintainerCanModify * bool `json:"maintainer_can_modify,omitempty"` } { Title : title , Body : body , Base : branch , MaintainerCanModify : canModify , } if open != nil && * open { op := " " data . State = & op } else if open != nil { cl := " " data . State = & cl } _ , err := c . request ( & request { // allow the description and draft fields // https://developer.github.com/changes/2018-02-22-label-description-search-preview/ // https://developer.github.com/changes/2019-02-14-draft-pull-requests/ accept : " " , method : http . MethodPatch , path : fmt . Sprintf ( " " , org , repo , number ) , requestBody : & data , exitCodes : [ ] int { 200 } , } , nil ) return err }
// UpdatePullRequest modifies the title, body, open state
UpdatePullRequest modifies the title body open state