Check if gitea is able to squash-merge via API (#336)

Check if gitea is able to squash-merge via API

Co-authored-by: 6543 <6543@obermui.de>
Reviewed-on: https://gitea.com/gitea/go-sdk/pulls/336
Reviewed-by: Andrew Thornton <art27@cantab.net>
Reviewed-by: CirnoT <cirnot@noreply.gitea.io>
This commit is contained in:
6543 2020-05-20 13:01:06 +00:00 committed by Andrew Thornton
parent bb6248f50d
commit 2cc36f912f

View file

@ -155,6 +155,11 @@ type MergePullRequestOption struct {
// MergePullRequest merge a PR to repository by PR id
func (c *Client) MergePullRequest(owner, repo string, index int64, opt MergePullRequestOption) (bool, error) {
if opt.Do == "squash" {
if err := c.CheckServerVersionConstraint(">=1.11.5"); err != nil {
return false, err
}
}
body, err := json.Marshal(&opt)
if err != nil {
return false, err