diff --git a/packages/notify/lib/utils.mjs b/packages/notify/lib/utils.mjs index c02d1ef..b9e4167 100644 --- a/packages/notify/lib/utils.mjs +++ b/packages/notify/lib/utils.mjs @@ -115,6 +115,23 @@ const configs = { }, }; +function getlog(since, until) { + return gitlog({ + repo: '.', + since, + until, + fields: ['hash', 'abbrevHash', 'subject'], + }); +} + +function getLogs() { + try { + return getlog(GIT_PREVIOUS_COMMIT, GIT_COMMIT); + } catch { + return getlog('HEAD~5', 'HEAD'); + } +} + function getCommits() { const io = GIT_COMMIT === GIT_PREVIOUS_COMMIT @@ -122,19 +139,12 @@ function getCommits() { : sortBy( Object.entries( groupBy( - gitlog - .default({ - repo: '.', - since: GIT_PREVIOUS_COMMIT, - until: GIT_COMMIT, - fields: ['hash', 'abbrevHash', 'subject'], - }) - .map(({ abbrevHash, hash, subject }) => ({ - hash, - abbrevHash, - message: sync(subject), - subject, - })), + getLogs().map(({ abbrevHash, hash, subject }) => ({ + hash, + abbrevHash, + message: sync(subject), + subject, + })), ({ message }) => message.type, ), ), diff --git a/packages/notify/package.json b/packages/notify/package.json index 4918c21..479b9bd 100644 --- a/packages/notify/package.json +++ b/packages/notify/package.json @@ -1,6 +1,6 @@ { "name": "@bring-it/notify", - "version": "0.2.1", + "version": "0.2.3", "description": "Send releases notifications", "license": "MIT", "author": {