Skip to content

Commit

Permalink
Correct upload asset code (#1805)
Browse files Browse the repository at this point in the history
1. Remove incorrect usage of await on synchronous method
2. Dispose of stream after use
  • Loading branch information
mungojam authored and ryangribble committed Jun 2, 2018
1 parent fc3e9c2 commit 03ee6d7
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions docs/releases.md
Original file line number Diff line number Diff line change
Expand Up @@ -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?

0 comments on commit 03ee6d7

Please sign in to comment.