From 1a46b6bf18a6bbe7f41fc75ee24235be58fba431 Mon Sep 17 00:00:00 2001 From: Eric Date: Thu, 21 Dec 2023 18:59:24 +0800 Subject: [PATCH] chore(notify): debug --- packages/notify/lib/utils.mjs | 23 ++++++++++++++++++++--- packages/notify/package.json | 2 +- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/packages/notify/lib/utils.mjs b/packages/notify/lib/utils.mjs index b9e4167..548feb8 100644 --- a/packages/notify/lib/utils.mjs +++ b/packages/notify/lib/utils.mjs @@ -1,3 +1,4 @@ +import { execSync } from 'node:child_process'; import { createRequire } from 'node:module'; import { sync } from 'conventional-commits-parser'; @@ -116,6 +117,8 @@ const configs = { }; function getlog(since, until) { + execSync(`git log --pretty=oneline ${since}...${until}`); + return gitlog({ repo: '.', since, @@ -127,14 +130,28 @@ function getlog(since, until) { function getLogs() { try { return getlog(GIT_PREVIOUS_COMMIT, GIT_COMMIT); - } catch { - return getlog('HEAD~5', 'HEAD'); + } catch (error) { + console.error(error); + + try { + return getlog('HEAD~5', 'HEAD'); + } catch (error_) { + console.error(error_); + + try { + return getlog('HEAD~1', 'HEAD'); + } catch (error__) { + console.error(error__); + + return []; + } + } } } function getCommits() { const io = - GIT_COMMIT === GIT_PREVIOUS_COMMIT + GIT_COMMIT && GIT_COMMIT === GIT_PREVIOUS_COMMIT ? [] : sortBy( Object.entries( diff --git a/packages/notify/package.json b/packages/notify/package.json index 479b9bd..7dc88c4 100644 --- a/packages/notify/package.json +++ b/packages/notify/package.json @@ -1,6 +1,6 @@ { "name": "@bring-it/notify", - "version": "0.2.3", + "version": "0.2.5", "description": "Send releases notifications", "license": "MIT", "author": {