Skip to content

Commit

Permalink
fix: delete release again if failed with "405 Not Allowed" (3 times)
Browse files Browse the repository at this point in the history
  • Loading branch information
develar committed Mar 13, 2016
1 parent f131e33 commit ebf783c
Showing 1 changed file with 18 additions and 5 deletions.
23 changes: 18 additions & 5 deletions src/gitHubPublisher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,12 +141,25 @@ export class GitHubPublisher implements Publisher {
}

//noinspection JSUnusedGlobalSymbols
deleteRelease(): BluebirdPromise<void> {
if (this._releasePromise.isFulfilled()) {
return gitHubRequest<void>(`/repos/${this.owner}/${this.repo}/releases/${this._releasePromise.value().id}`, this.token, null, "DELETE")
}
else {
async deleteRelease(): Promise<void> {
if (!this._releasePromise.isFulfilled()) {
return BluebirdPromise.resolve()
}

for (let i = 0; i < 3; i++) {
try {
return await
gitHubRequest<void>(`/repos/${this.owner}/${this.repo}/releases/${this._releasePromise.value().id}`, this.token, null, "DELETE")
}
catch (e) {
if (e instanceof HttpError && (e.response.statusCode === 405 || e.response.statusCode === 502)) {
continue
}

throw e
}
}

log("WARN: Cannot delete release " + this._releasePromise.value().id)
}
}

0 comments on commit ebf783c

Please sign in to comment.