Skip to content

Commit

Permalink
USE URL from API when private
Browse files Browse the repository at this point in the history
Signed-off-by: Matt Clegg <[email protected]>
  • Loading branch information
mattclegg committed Jun 28, 2024
1 parent a31e38a commit afc8918
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion pkg/github/github.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit afc8918

Please sign in to comment.