From 3193d29de9e24d3fe77de0db6cafdaaa217fe380 Mon Sep 17 00:00:00 2001 From: Bender Date: Mon, 19 Sep 2022 20:32:20 +0200 Subject: [PATCH] fix(git): fetch tags to ensure up-to-date git --- lib/cli/shipit.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/cli/shipit.ts b/lib/cli/shipit.ts index 61ae764..9d40c8d 100644 --- a/lib/cli/shipit.ts +++ b/lib/cli/shipit.ts @@ -13,9 +13,9 @@ interface Props { export const shipitHandler = async ({ gitEmail, gitUser, tagPrefix, failOnMissingCommit, forceBump, releaseBranchPrefix }: Props) => { const git = simpleGit() - await git.pull() - const tags = await git.tags({ '--sort': '-creatordate' }) + // Fetch tags to ensure we have the latest ones. + const tags = await git.fetch(['--tags']).tags({ '--sort': '-creatordate' }) const log = await git.log({ '--max-count': 20 }) const branch = await git.branch() const [remote] = await git.getRemotes() @@ -35,6 +35,7 @@ export const shipitHandler = async ({ gitEmail, gitUser, tagPrefix, failOnMissin throw new Error('Latest commit was not found!') } + // @TODO: Fetch all in case from is 0.0.0 (non-existent). const commits = await git.log({ from: tags.latest, to: latestCommit, @@ -57,7 +58,7 @@ export const shipitHandler = async ({ gitEmail, gitUser, tagPrefix, failOnMissin console.log('Bumps: ', bumps) - // Bump minor in case nothing is found. + // Bump patch in case nothing is found. if (bumps.length < 1 && forceBump) { console.log('Forcing patch bump!') bumps.push(BumpType.Patch)