diff --git a/src/gitHubPublisher.ts b/src/gitHubPublisher.ts index 806faa3a60f..b8ee6ba8761 100644 --- a/src/gitHubPublisher.ts +++ b/src/gitHubPublisher.ts @@ -141,12 +141,25 @@ export class GitHubPublisher implements Publisher { } //noinspection JSUnusedGlobalSymbols - deleteRelease(): BluebirdPromise { - if (this._releasePromise.isFulfilled()) { - return gitHubRequest(`/repos/${this.owner}/${this.repo}/releases/${this._releasePromise.value().id}`, this.token, null, "DELETE") - } - else { + async deleteRelease(): Promise { + if (!this._releasePromise.isFulfilled()) { return BluebirdPromise.resolve() } + + for (let i = 0; i < 3; i++) { + try { + return await + gitHubRequest(`/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) } } \ No newline at end of file