Skip to content

Commit 27502f7

Browse files
committed
update gitlab
Signed-off-by: jolheiser <[email protected]>
1 parent f9aa650 commit 27502f7

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

vcs/gitlab/gitlab.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,9 @@ func NewClient(baseURL, token string, preverified bool) (*Client, error) {
2626
if err != nil {
2727
return nil, fmt.Errorf("can't parse URL: %v", err)
2828
}
29-
u.Path = path.Join(u.Path, "/api/v4")
3029
u.Scheme = "https"
30+
host := u.String()
31+
u.Path = path.Join(u.Path, "/api/v4")
3132

3233
client, err := gitlab.NewClient(token, gitlab.WithBaseURL(u.String()))
3334
if err != nil {
@@ -43,7 +44,7 @@ func NewClient(baseURL, token string, preverified bool) (*Client, error) {
4344

4445
return &Client{
4546
api: client,
46-
host: baseURL,
47+
host: host,
4748
colors: map[string]int{},
4849
labelColors: map[string]string{},
4950
}, nil
@@ -82,6 +83,7 @@ func (c *Client) Issues(owner string, name string) ([]vcs.Issue, error) {
8283
ID: v.IID,
8384
Title: v.Title,
8485
CreatedAt: *v.CreatedAt,
86+
URL: v.WebURL,
8587
}
8688
for _, l := range v.Labels {
8789
issue.Labels = append(issue.Labels, vcs.Label{
@@ -124,6 +126,7 @@ func (c *Client) PullRequests(owner string, name string) ([]vcs.PullRequest, err
124126
ID: v.IID,
125127
Title: v.Title,
126128
CreatedAt: *v.CreatedAt,
129+
URL: v.WebURL,
127130
}
128131
for _, l := range v.Labels {
129132
pr.Labels = append(pr.Labels, vcs.Label{
@@ -232,6 +235,7 @@ func (c *Client) Branches(owner string, name string) ([]vcs.Branch, error) {
232235
CommittedAt: *v.Commit.CommittedDate,
233236
Author: v.Commit.CommitterName,
234237
},
238+
URL: v.WebURL,
235239
}
236240
i = append(i, branch)
237241
}
@@ -266,6 +270,7 @@ func (c *Client) History(repo vcs.Repo, max int, since time.Time) ([]vcs.Commit,
266270
MessageHeadline: strings.ReplaceAll(v.Title, "\u00A0", " "),
267271
CommittedAt: *v.CommittedDate,
268272
Author: v.AuthorName,
273+
URL: v.WebURL,
269274
})
270275
}
271276

@@ -304,6 +309,7 @@ func (c *Client) repoFromAPI(p *gitlab.Project) vcs.Repo {
304309
Name: r[0].Name,
305310
TagName: r[0].TagName,
306311
PublishedAt: *r[0].CreatedAt,
312+
URL: fmt.Sprintf("%s%s", c.host, r[0].TagPath),
307313
}
308314
}
309315

0 commit comments

Comments
 (0)