Skip to content

Commit

Permalink
feature(wisdom) release: add ablity to show an error when releasing o…
Browse files Browse the repository at this point in the history
…n github
  • Loading branch information
coderaiser committed Aug 30, 2021
1 parent b1c0543 commit 58aace1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
21 changes: 11 additions & 10 deletions lib/release.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import grizzly from 'grizzly';
import currify from 'currify';
import tryToCatch from 'try-to-catch';

const isUndefined = (a) => typeof a === 'undefined';

export default currify(setTag);

const rmScope = (a) => a.replace(/^@.*\//, '');

function setTag(version, info, chlog, emitter, callback) {
async function setTag(version, info, chlog, emitter, callback) {
if (!info.release && !isUndefined(info.release)) {
emitter.emit('data', 'release: false\n');
return callback();
Expand All @@ -30,15 +31,15 @@ function setTag(version, info, chlog, emitter, callback) {
body,
};

grizzly(null, data)
.then(() => {
emitter.emit('data', 'release: ok\n');
callback();
})
.catch(() => {
emitter.emit('data', 'Error releasing on github. Trying again.\n');
setTag(version, info, chlog, emitter, callback);
});
const [error] = await tryToCatch(grizzly, null, data);

if (!error) {
emitter.emit('data', 'release: ok\n');
callback();
}

emitter.emit('data', `Error releasing on github : ${error.message}. Trying again.\n`);
await setTag(version, info, chlog, emitter, callback);
}

function getRepoName(json) {
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
"rendy": "^3.0.1",
"simport": "^1.2.0",
"try-catch": "^3.0.0",
"try-to-catch": "^3.0.0",
"version-io": "^4.0.0"
},
"license": "MIT",
Expand Down

0 comments on commit 58aace1

Please sign in to comment.