-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
download to release #2742
Comments
Could you do something like the following? using Octokit;
using System;
using System.Net.Http;
using System.IO;
using System.Threading.Tasks;
var client = new GitHubClient(new ProductHeaderValue("MyApp"));
var release = await client.Repository.Release.Get("integrations", "terraform-provider-github", "v5.29.0");
Console.WriteLine($"Release {release.Name} has {release.Assets.Count} assets");
using (var httpClient = new HttpClient())
{
foreach (var asset in release.Assets)
{
Console.WriteLine($"Retrieving {asset.Name}");
var fileData = await httpClient.GetByteArrayAsync(asset.BrowserDownloadUrl);
File.WriteAllBytes(asset.Name, fileData);
}
} |
my repository is private. chatgpt create this code ` var asset = release.Assets.FirstOrDefault(a => a.Name == file_name);
` but I don't know how to integrate the verification of downloaded files |
What do you mean by "integrate the verification of downloaded files"? |
check if the downloaded file was current, or if it is in an inconsistent state. I know you are using a checksum. for example if the downalod stops the internet what happens to the file? |
however the above code doesn't work, it fails to connect giving a 404 error i can't figure out how to use the token, with your toolkit it works so it's a problem of my code. Could I have an example of the code? Thanks in advance ps: I also tried using a token with full permissions but it gives the same error |
this code it works for me ` try
|
Describe the need
I'm trying to download a release file but there's nothing written in the documentation, I haven't found anything useful even in the questions.
Could you have some examples? A thousand thanks
SDK Version
No response
API Version
No response
Relevant log output
No response
Code of Conduct
The text was updated successfully, but these errors were encountered: