Skip to content

Commit 5b2fe68

Browse files
authored
feat(vcs): display gh response (#5561)
* feat: display gh response Signed-off-by: Yvonnick Esnault <[email protected]>
1 parent 9de27a5 commit 5b2fe68

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

engine/vcs/github/client_status.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ func (g *githubClient) SetStatus(ctx context.Context, event sdk.Event) error {
6565
}
6666
buf := bytes.NewBuffer(b)
6767

68+
log.Debug("SetStatus> github post on %v body:%v", path, string(b))
69+
6870
res, err := g.post(path, "application/json", buf, nil)
6971
if err != nil {
7072
return sdk.WrapError(err, "Unable to post status")
@@ -77,6 +79,8 @@ func (g *githubClient) SetStatus(ctx context.Context, event sdk.Event) error {
7779
return sdk.WrapError(err, "Unable to read body")
7880
}
7981

82+
log.Debug("SetStatus> github response for %v body:%v", path, string(body))
83+
8084
if res.StatusCode != 201 {
8185
return sdk.WrapError(err, "Unable to create status on github. Status code : %d - Body: %s - target:%s", res.StatusCode, body, data.urlPipeline)
8286
}

engine/vcs/github/http.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,12 +143,12 @@ func (c *githubClient) post(path string, bodyType string, body io.Reader, opts *
143143
req.Header.Add("Accept", "application/json")
144144
if opts.asUser && c.token != "" {
145145
req.SetBasicAuth(c.username, c.token)
146+
log.Debug("Github API>> Request URL %s with basicAuth username:%v len:%d", req.URL.String(), c.username, len(c.token))
146147
} else {
147148
req.Header.Add("Authorization", fmt.Sprintf("token %s", c.OAuthToken))
149+
log.Debug("Github API>> Request URL %s with Authorization", req.URL.String())
148150
}
149151

150-
log.Debug("Github API>> Request URL %s", req.URL.String())
151-
152152
return httpClient.Do(req)
153153
}
154154

0 commit comments

Comments
 (0)