From afc89182c63f41526e0c7c8a6a7826ca2f748775 Mon Sep 17 00:00:00 2001 From: Matt Clegg Date: Fri, 28 Jun 2024 13:00:10 +0100 Subject: [PATCH] USE URL from API when private Signed-off-by: Matt Clegg --- pkg/github/github.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/pkg/github/github.go b/pkg/github/github.go index 4143c50d..978c4a91 100644 --- a/pkg/github/github.go +++ b/pkg/github/github.go @@ -92,11 +92,21 @@ func (c *Client) GetRelease(_ context.Context, tag string) (*Release, error) { return nil, err } + repository, _, err := c.Repositories.Get(context.TODO(), c.owner, c.repo) + if err != nil { + return nil, err + } + result := &Release{ Assets: []*Asset{}, } + for _, ass := range release.Assets { - asset := &Asset{*ass.Name, *ass.BrowserDownloadURL} + assURL := *ass.BrowserDownloadURL + if *repository.Private { + assURL = *ass.URL + } + asset := &Asset{*ass.Name, assURL} result.Assets = append(result.Assets, asset) } return result, nil