try try try again

This commit is contained in:
softprops 2019-09-09 20:46:36 +09:00
parent cf2aed3a12
commit e197e56931
2 changed files with 37 additions and 26 deletions

View File

@ -49,6 +49,7 @@ exports.release = (config, gh) => __awaiter(void 0, void 0, void 0, function* ()
catch (error) { catch (error) {
if (error.status === 404) { if (error.status === 404) {
console.log("Creating new release..."); console.log("Creating new release...");
try {
const tag_name = config.github_ref.replace("refs/tags/", ""); const tag_name = config.github_ref.replace("refs/tags/", "");
const name = config.input_name || tag_name; const name = config.input_name || tag_name;
const body = config.input_body; const body = config.input_body;
@ -63,6 +64,11 @@ exports.release = (config, gh) => __awaiter(void 0, void 0, void 0, function* ()
}); });
return release.data; return release.data;
} }
catch (error) {
console.log(`created failed with status: ${error.status}`);
return exports.release(config, gh);
}
}
else { else {
console.log(`Unexpected error fetching github release for tag ${config.github_ref}: ${error}`); console.log(`Unexpected error fetching github release for tag ${config.github_ref}: ${error}`);
throw error; throw error;

View File

@ -67,6 +67,7 @@ export const release = async (
} catch (error) { } catch (error) {
if (error.status === 404) { if (error.status === 404) {
console.log("Creating new release..."); console.log("Creating new release...");
try {
const tag_name = config.github_ref.replace("refs/tags/", ""); const tag_name = config.github_ref.replace("refs/tags/", "");
const name = config.input_name || tag_name; const name = config.input_name || tag_name;
const body = config.input_body; const body = config.input_body;
@ -80,6 +81,10 @@ export const release = async (
draft draft
}); });
return release.data; return release.data;
} catch (error) {
console.log(`created failed with status: ${error.status}`);
return release(config, gh);
}
} else { } else {
console.log(`Unexpected error fetching github release for tag ${config.github_ref}: ${error}`); console.log(`Unexpected error fetching github release for tag ${config.github_ref}: ${error}`);
throw error; throw error;