Skip to content

Commit afc8918

Browse files
committed
USE URL from API when private
Signed-off-by: Matt Clegg <[email protected]>
1 parent a31e38a commit afc8918

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

pkg/github/github.go

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,11 +92,21 @@ func (c *Client) GetRelease(_ context.Context, tag string) (*Release, error) {
9292
return nil, err
9393
}
9494

95+
repository, _, err := c.Repositories.Get(context.TODO(), c.owner, c.repo)
96+
if err != nil {
97+
return nil, err
98+
}
99+
95100
result := &Release{
96101
Assets: []*Asset{},
97102
}
103+
98104
for _, ass := range release.Assets {
99-
asset := &Asset{*ass.Name, *ass.BrowserDownloadURL}
105+
assURL := *ass.BrowserDownloadURL
106+
if *repository.Private {
107+
assURL = *ass.URL
108+
}
109+
asset := &Asset{*ass.Name, assURL}
100110
result.Assets = append(result.Assets, asset)
101111
}
102112
return result, nil

0 commit comments

Comments
 (0)