From 09157020971b8a96b37ddc4a2e1f8ba95a165512 Mon Sep 17 00:00:00 2001 From: Edward Kim Date: Tue, 1 Apr 2025 18:43:12 +1100 Subject: [PATCH] add draft Signed-off-by: Edward Kim --- bitbucket.go | 9 +++++---- pullrequests.go | 6 +++++- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/bitbucket.go b/bitbucket.go index d874a6d..3309083 100644 --- a/bitbucket.go +++ b/bitbucket.go @@ -314,6 +314,7 @@ type PullRequestsOptions struct { States []string `json:"states"` Query string `json:"query"` Sort string `json:"sort"` + Draft bool `json:"draft"` ctx context.Context } @@ -665,8 +666,8 @@ func (dk *DeployKeyOptions) WithContext(ctx context.Context) *DeployKeyOptions { } type SSHKeyOptions struct { - Owner string `json:"owner"` - Uuid string `json:"uuid"` - Label string `json:"label"` - Key string `json:"key"` + Owner string `json:"owner"` + Uuid string `json:"uuid"` + Label string `json:"label"` + Key string `json:"key"` } diff --git a/pullrequests.go b/pullrequests.go index edebf32..a4c012c 100644 --- a/pullrequests.go +++ b/pullrequests.go @@ -242,10 +242,14 @@ func (p *PullRequests) buildPullRequestBody(po *PullRequestsOptions) (string, er body["message"] = po.Message } - if po.CloseSourceBranch == true || po.CloseSourceBranch == false { + if po.CloseSourceBranch || !po.CloseSourceBranch { body["close_source_branch"] = po.CloseSourceBranch } + if po.Draft { + body["draft"] = true + } + data, err := json.Marshal(body) if err != nil { return "", err