delete assets that failed to upload

[#121455813]

Signed-off-by: Yucheng Tu <ytu@pivotal.io>
This commit is contained in:
Evan Short
2016-06-13 17:45:11 -07:00
committed by Yucheng Tu
parent de0080906a
commit b0114ca8b4
2 changed files with 28 additions and 15 deletions

View File

@@ -81,6 +81,11 @@ func (c *OutCommand) Run(sourceDir string, request OutRequest) (OutResponse, err
}
if existingRelease != nil {
releaseAssets, err := c.github.ListReleaseAssets(*existingRelease)
if err != nil {
return OutResponse{}, err
}
existingRelease.Name = github.String(name)
existingRelease.TargetCommitish = github.String(targetCommitish)
existingRelease.Draft = github.Bool(draft)
@@ -89,7 +94,7 @@ func (c *OutCommand) Run(sourceDir string, request OutRequest) (OutResponse, err
existingRelease.Body = github.String(body)
}
for _, asset := range existingRelease.Assets {
for _, asset := range releaseAssets {
fmt.Fprintf(c.writer, "clearing existing asset: %s\n", *asset.Name)
err := c.github.DeleteReleaseAsset(asset)