Fix tests
This commit is contained in:
@@ -27,16 +27,22 @@ class Action {
|
||||
}
|
||||
createOrUpdateRelease() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
try {
|
||||
return yield this.createRelease();
|
||||
if (this.inputs.allowUpdates) {
|
||||
try {
|
||||
const getResponse = yield this.releases.getByTag(this.inputs.tag);
|
||||
return yield this.updateRelease(getResponse.data.id);
|
||||
}
|
||||
catch (error) {
|
||||
if (this.noRelease(error)) {
|
||||
return yield this.createRelease();
|
||||
}
|
||||
else {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (error) {
|
||||
if (this.releaseAlreadyExisted(error) && this.inputs.allowUpdates) {
|
||||
return this.updateRelease();
|
||||
}
|
||||
else {
|
||||
throw error;
|
||||
}
|
||||
else {
|
||||
return yield this.createRelease();
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -46,14 +52,12 @@ class Action {
|
||||
return response.data.upload_url;
|
||||
});
|
||||
}
|
||||
releaseAlreadyExisted(error) {
|
||||
noRelease(error) {
|
||||
const errorMessage = new ErrorMessage_1.ErrorMessage(error);
|
||||
return errorMessage.hasErrorWithCode('already_exists');
|
||||
return errorMessage.status == 404;
|
||||
}
|
||||
updateRelease() {
|
||||
updateRelease(id) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const getResponse = yield this.releases.getByTag(this.inputs.tag);
|
||||
const id = getResponse.data.id;
|
||||
const response = yield this.releases.update(id, this.inputs.tag, this.inputs.body, this.inputs.commit, this.inputs.draft, this.inputs.name);
|
||||
return response.data.upload_url;
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user