@@ -67,16 +67,16 @@ func (g *GithubClient) ListLatestCLCoreTags(count int) ([]*github.RepositoryTag,
6767 return tags , err
6868}
6969
70- func (g * GithubClient ) DownloadAssetFromRelease (owner , repository , releaseTag , assetName string ) ([]byte , error ) {
70+ func (g * GithubClient ) DownloadAssetFromRelease (owner , repository , releaseTag , assetName string ) ([]byte , * github. Response , error ) {
7171 var content []byte
7272
7373 // assuming 180s is enough to fetch releases, find the asset we need and download it
7474 // some assets might be 30+ MB, so we need to give it some time (for really slow connections)
7575 ctx , cancelFn := context .WithTimeout (context .Background (), 180 * time .Second )
7676 defer cancelFn ()
77- ghReleases , _ , err := g .client .Repositories .ListReleases (ctx , owner , repository , & github.ListOptions {PerPage : 20 })
77+ ghReleases , ghResponse , err := g .client .Repositories .ListReleases (ctx , owner , repository , & github.ListOptions {PerPage : 20 })
7878 if err != nil {
79- return content , errors .Wrapf (err , "failed to list releases for %s" , repository )
79+ return content , ghResponse , errors .Wrapf (err , "failed to list releases for %s" , repository )
8080 }
8181
8282 var ghRelease * github.RepositoryRelease
@@ -92,7 +92,7 @@ func (g *GithubClient) DownloadAssetFromRelease(owner, repository, releaseTag, a
9292 }
9393
9494 if ghRelease == nil {
95- return content , errors .New ("failed to find release with tag: " + releaseTag )
95+ return content , ghResponse , errors .New ("failed to find release with tag: " + releaseTag )
9696 }
9797
9898 var assetID int64
@@ -104,18 +104,18 @@ func (g *GithubClient) DownloadAssetFromRelease(owner, repository, releaseTag, a
104104 }
105105
106106 if assetID == 0 {
107- return content , fmt .Errorf ("failed to find asset %s for %s" , assetName , * ghRelease .TagName )
107+ return content , ghResponse , fmt .Errorf ("failed to find asset %s for %s" , assetName , * ghRelease .TagName )
108108 }
109109
110110 asset , _ , err := g .client .Repositories .DownloadReleaseAsset (ctx , owner , repository , assetID , g .client .Client ())
111111 if err != nil {
112- return content , errors .Wrapf (err , "failed to download asset %s for %s" , assetName , * ghRelease .TagName )
112+ return content , ghResponse , errors .Wrapf (err , "failed to download asset %s for %s" , assetName , * ghRelease .TagName )
113113 }
114114
115115 content , err = io .ReadAll (asset )
116116 if err != nil {
117- return content , err
117+ return content , ghResponse , err
118118 }
119119
120- return content , nil
120+ return content , ghResponse , nil
121121}
0 commit comments