feat(tools): pr_merge
This commit is contained in:
@@ -103,6 +103,25 @@ func (c *Client) GetPullRequestDiff(ctx context.Context, owner, repo string, ind
|
||||
return resp.Body, nil
|
||||
}
|
||||
|
||||
type MergePRArgs struct {
|
||||
Do string `json:"Do"`
|
||||
Title string `json:"merge_message_title,omitempty"`
|
||||
Body string `json:"merge_message_field,omitempty"`
|
||||
}
|
||||
|
||||
func (c *Client) MergePullRequest(ctx context.Context, owner, repo string, index int, args MergePRArgs) error {
|
||||
p := fmt.Sprintf("/api/v1/repos/%s/%s/pulls/%d/merge", owner, repo, index)
|
||||
payload, err := json.Marshal(args)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
body, status, err := c.PostJSON(ctx, p, payload)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return MapStatus(status, body)
|
||||
}
|
||||
|
||||
func (c *Client) ListPullRequests(ctx context.Context, owner, repo, state, head string, page, limit int) ([]PullRequest, error) {
|
||||
if page < 1 {
|
||||
page = 1
|
||||
|
||||
Reference in New Issue
Block a user