fix(git): Prevents getLastTagNotInBaseBranch from returning a commit hash #1262
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
closes #1261
What Changed
This PR removes functionality where
getLastTagNotInBaseBranch
would previously return the first commit on a branch if no tag was found.Why
getLastTagNotInBaseBranch
is called in thenpm
plugin, but the value is then passed todetermineNextVersion
, where it attempts to run semver operations on the provided tag. When the tag is instead a commit hash, the semver operations fail out gracelessly.Within #1261, @hipstersmoothie suggests making
determineNextVersion
take optionallastVersion?
andcurrentVersion?
s with appropriate handling, however I'm unsure that's necessary given all calls or references togetLastTagNotInBaseBranch
are currently piped over to some default value (1, 2, 3 - managed by this PR, 4).Unfortunately, I'm having difficulty further validating, as my monorepo no longer falls into this state..
Todo:
📦 Published PR as canary version:
under canary scope @auto-canary@9.36.3-canary.1262.16149.0
✨ Test out this PR locally via:
npm install @auto-canary/bot-list@9.36.3-canary.1262.16149.0 npm install @auto-canary/auto@9.36.3-canary.1262.16149.0 npm install @auto-canary/core@9.36.3-canary.1262.16149.0 npm install @auto-canary/all-contributors@9.36.3-canary.1262.16149.0 npm install @auto-canary/brew@9.36.3-canary.1262.16149.0 npm install @auto-canary/chrome@9.36.3-canary.1262.16149.0 npm install @auto-canary/cocoapods@9.36.3-canary.1262.16149.0 npm install @auto-canary/conventional-commits@9.36.3-canary.1262.16149.0 npm install @auto-canary/crates@9.36.3-canary.1262.16149.0 npm install @auto-canary/exec@9.36.3-canary.1262.16149.0 npm install @auto-canary/first-time-contributor@9.36.3-canary.1262.16149.0 npm install @auto-canary/gem@9.36.3-canary.1262.16149.0 npm install @auto-canary/gh-pages@9.36.3-canary.1262.16149.0 npm install @auto-canary/git-tag@9.36.3-canary.1262.16149.0 npm install @auto-canary/gradle@9.36.3-canary.1262.16149.0 npm install @auto-canary/jira@9.36.3-canary.1262.16149.0 npm install @auto-canary/maven@9.36.3-canary.1262.16149.0 npm install @auto-canary/npm@9.36.3-canary.1262.16149.0 npm install @auto-canary/omit-commits@9.36.3-canary.1262.16149.0 npm install @auto-canary/omit-release-notes@9.36.3-canary.1262.16149.0 npm install @auto-canary/released@9.36.3-canary.1262.16149.0 npm install @auto-canary/s3@9.36.3-canary.1262.16149.0 npm install @auto-canary/slack@9.36.3-canary.1262.16149.0 npm install @auto-canary/twitter@9.36.3-canary.1262.16149.0 npm install @auto-canary/upload-assets@9.36.3-canary.1262.16149.0 # or yarn add @auto-canary/bot-list@9.36.3-canary.1262.16149.0 yarn add @auto-canary/auto@9.36.3-canary.1262.16149.0 yarn add @auto-canary/core@9.36.3-canary.1262.16149.0 yarn add @auto-canary/all-contributors@9.36.3-canary.1262.16149.0 yarn add @auto-canary/brew@9.36.3-canary.1262.16149.0 yarn add @auto-canary/chrome@9.36.3-canary.1262.16149.0 yarn add @auto-canary/cocoapods@9.36.3-canary.1262.16149.0 yarn add @auto-canary/conventional-commits@9.36.3-canary.1262.16149.0 yarn add @auto-canary/crates@9.36.3-canary.1262.16149.0 yarn add @auto-canary/exec@9.36.3-canary.1262.16149.0 yarn add @auto-canary/first-time-contributor@9.36.3-canary.1262.16149.0 yarn add @auto-canary/gem@9.36.3-canary.1262.16149.0 yarn add @auto-canary/gh-pages@9.36.3-canary.1262.16149.0 yarn add @auto-canary/git-tag@9.36.3-canary.1262.16149.0 yarn add @auto-canary/gradle@9.36.3-canary.1262.16149.0 yarn add @auto-canary/jira@9.36.3-canary.1262.16149.0 yarn add @auto-canary/maven@9.36.3-canary.1262.16149.0 yarn add @auto-canary/npm@9.36.3-canary.1262.16149.0 yarn add @auto-canary/omit-commits@9.36.3-canary.1262.16149.0 yarn add @auto-canary/omit-release-notes@9.36.3-canary.1262.16149.0 yarn add @auto-canary/released@9.36.3-canary.1262.16149.0 yarn add @auto-canary/s3@9.36.3-canary.1262.16149.0 yarn add @auto-canary/slack@9.36.3-canary.1262.16149.0 yarn add @auto-canary/twitter@9.36.3-canary.1262.16149.0 yarn add @auto-canary/upload-assets@9.36.3-canary.1262.16149.0