mirror of
https://github.com/zoriya/octokit.net.git
synced 2025-12-06 07:16:09 +00:00
Correct upload asset code (#1805)
1. Remove incorrect usage of await on synchronous method 2. Dispose of stream after use
This commit is contained in:
committed by
Ryan Gribble
parent
fc3e9c2cd2
commit
03ee6d7bb8
@@ -48,15 +48,16 @@ var result = await client.Repository.Release.Edit("octokit", "octokit.net", 1, u
|
||||
If you have any assets to include with the release, you can upload them after creating the release:
|
||||
|
||||
```csharp
|
||||
var archiveContents = await File.OpenRead("output.zip"); // TODO: better sample
|
||||
var assetUpload = new ReleaseAssetUpload()
|
||||
{
|
||||
FileName = "my-cool-project-1.0.zip",
|
||||
ContentType = "application/zip",
|
||||
RawData = archiveContents
|
||||
};
|
||||
var release = client.Repository.Release.Get("octokit", "octokit.net", 1);
|
||||
var asset = await client.Repository.Release.UploadAsset(release, assetUpload);
|
||||
using(var archiveContents = File.OpenRead("output.zip")) { // TODO: better sample
|
||||
var assetUpload = new ReleaseAssetUpload()
|
||||
{
|
||||
FileName = "my-cool-project-1.0.zip",
|
||||
ContentType = "application/zip",
|
||||
RawData = archiveContents
|
||||
};
|
||||
var release = client.Repository.Release.Get("octokit", "octokit.net", 1);
|
||||
var asset = await client.Repository.Release.UploadAsset(release, assetUpload);
|
||||
}
|
||||
```
|
||||
|
||||
**TODO:** are there any known limits documented to upload assets?
|
||||
|
||||
Reference in New Issue
Block a user