Skip to content

Commit 3f920fc

Browse files
committed
update TriggerPipeline
1 parent 4aedc57 commit 3f920fc

File tree

1 file changed

+3
-11
lines changed

1 file changed

+3
-11
lines changed

pipelines.go

+3-11
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package bitbucket
33
import (
44
"encoding/json"
55
"fmt"
6-
"io"
76
"io/ioutil"
87
"net/url"
98
)
@@ -129,7 +128,7 @@ type BitbucketTrigerPipelineRequestBody struct {
129128
} `json:"target"`
130129
}
131130

132-
func (p *Pipelines) TriggerPipeline(po *PipelinesOptions, body *BitbucketTrigerPipelineRequestBody) (string, error) {
131+
func (p *Pipelines) TriggerPipeline(po *PipelinesOptions, body *BitbucketTrigerPipelineRequestBody) (interface{}, error) {
133132
urlStr := p.c.requestUrl("/repositories/%s/%s/pipelines/", po.Owner, po.RepoSlug)
134133

135134
b, err := json.Marshal(body)
@@ -138,17 +137,10 @@ func (p *Pipelines) TriggerPipeline(po *PipelinesOptions, body *BitbucketTrigerP
138137
}
139138
data := string(b)
140139

141-
p.c.execute("POST", urlStr, data)
142-
responseBody, err := p.c.executeRaw("GET", urlStr, "")
140+
responseBody, err := p.c.execute("POST", urlStr, data)
143141
if err != nil {
144142
return "failed to trigger bitbucket pipeline", err
145143
}
146-
defer responseBody.Close()
147144

148-
rawBody, err := io.ReadAll(responseBody)
149-
if err != nil {
150-
return "", err
151-
}
152-
153-
return string(rawBody), nil
145+
return responseBody, nil
154146
}

0 commit comments

Comments
 (0)