Fix to provide correct previous version when the current commit is tagged.

This commit is contained in:
Paul Hatcherian 2022-12-17 19:00:10 -06:00
parent 92bc0a8ba4
commit ba6e71e658
5 changed files with 32 additions and 4 deletions

View file

@ -31,7 +31,8 @@ export class DefaultLastReleaseResolver implements LastReleaseResolver {
// so that we will have an accurate increment (assuming the new tag is the expected one)
const command = `git for-each-ref --count=2 --sort=-v:*refname --format=%(refname:short) --merged=${current} ${refPrefixPattern}${releasePattern}`;
tag = await cmd(command);
tag = tag.split('\n').at(-1) || '';
tag = tag.split('\n').reverse().find(t => t !== '' && t !== currentTag) || '';
} else {
const command = `git for-each-ref --count=1 --sort=-v:*refname --format=%(refname:short) --merged=${current} ${refPrefixPattern}${releasePattern}`;
tag = await cmd(command);