Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only send select fields to edit API calls #12965

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
22 changes: 20 additions & 2 deletions prow/github/client.go
Expand Up @@ -1276,12 +1276,21 @@ func (c *client) EditPullRequest(org, repo string, number int, pr *PullRequest)
if c.dry {
return pr, nil
}
edit := struct {
Title string `json:"title,omitempty"`
Body string `json:"body,omitempty"`
State string `json:"state,omitempty"`
}{
Title: pr.Title,
Body: pr.Body,
State: pr.State,
}
var ret PullRequest
_, err := c.request(&request{
method: http.MethodPatch,
path: fmt.Sprintf("/repos/%s/%s/pulls/%d", org, repo, number),
exitCodes: []int{200},
requestBody: &pr,
requestBody: &edit,
}, &ret)
if err != nil {
return nil, err
Expand Down Expand Up @@ -1314,12 +1323,21 @@ func (c *client) EditIssue(org, repo string, number int, issue *Issue) (*Issue,
if c.dry {
return issue, nil
}
edit := struct {
Title string `json:"title,omitempty"`
Body string `json:"body,omitempty"`
State string `json:"state,omitempty"`
}{
Title: issue.Title,
Body: issue.Body,
State: issue.State,
}
var ret Issue
_, err := c.request(&request{
method: http.MethodPatch,
path: fmt.Sprintf("/repos/%s/%s/issues/%d", org, repo, number),
exitCodes: []int{200},
requestBody: &issue,
requestBody: &edit,
}, &ret)
if err != nil {
return nil, err
Expand Down