mirror of
https://github.com/PaulHatch/semantic-version.git
synced 2026-04-07 00:26:53 +00:00
Update "no tags" warning to indicate if tags were found.
This commit is contained in:
parent
5f6f89c4e0
commit
270924986e
4 changed files with 38 additions and 20 deletions
|
|
@ -21,12 +21,14 @@ export class DefaultLastReleaseResolver implements LastReleaseResolver {
|
|||
let currentTag = (await cmd(
|
||||
`git tag --points-at ${current} ${releasePattern}`
|
||||
)).trim();
|
||||
|
||||
|
||||
currentTag = tagFormatter.IsValid(currentTag) ? currentTag : '';
|
||||
const isTagged = currentTag !== '';
|
||||
|
||||
const [currentMajor, currentMinor, currentPatch] = !!currentTag ? tagFormatter.Parse(currentTag) : [null, null, null];
|
||||
|
||||
let tagsCount = 0;
|
||||
|
||||
let tag = '';
|
||||
try {
|
||||
const refPrefixPattern = this.useBranches ? 'refs/heads/' : 'refs/tags/';
|
||||
|
|
@ -34,16 +36,16 @@ export class DefaultLastReleaseResolver implements LastReleaseResolver {
|
|||
// If we already have the current branch tagged, we are checking for the previous one
|
||||
// so that we will have an accurate increment (assuming the new tag is the expected one)
|
||||
const command = `git for-each-ref --sort=-v:*refname --format=%(refname:short) --merged=${current} ${refPrefixPattern}${releasePattern}`;
|
||||
tag = await cmd(command);
|
||||
tag = tag
|
||||
.split('\n')
|
||||
const tags = (await cmd(command)).split('\n')
|
||||
tagsCount = tags.length;
|
||||
tag = tags
|
||||
.find(t => tagFormatter.IsValid(t) && t !== currentTag) || '';
|
||||
|
||||
} else {
|
||||
const command = `git for-each-ref --sort=-v:*refname --format=%(refname:short) --merged=${current} ${refPrefixPattern}${releasePattern}`;
|
||||
let tags = await cmd(command);
|
||||
const tags = (await cmd(command)).split('\n')
|
||||
tagsCount = tags.length;
|
||||
tag = tags
|
||||
.split('\n')
|
||||
.find(t => tagFormatter.IsValid(t)) || '';
|
||||
}
|
||||
|
||||
|
|
@ -60,7 +62,11 @@ export class DefaultLastReleaseResolver implements LastReleaseResolver {
|
|||
// practice this isn't likely to happen, but it keeps the test output from being
|
||||
// polluted with a bunch of warnings.
|
||||
|
||||
core.warning('No tags are present for this repository. If this is unexpected, check to ensure that tags have been pulled from the remote.');
|
||||
if (tagsCount > 0) {
|
||||
core.warning(`None of the ${tagsCount} tags(s) found were valid version tags for the present configuration. If this is unexpected, check to ensure that the configuration is correct and matches the tag format you are using.`);
|
||||
} else {
|
||||
core.warning('No tags are present for this repository. If this is unexpected, check to ensure that tags have been pulled from the remote.');
|
||||
}
|
||||
}
|
||||
// no release tags yet, use the initial commit as the root
|
||||
return new ReleaseInformation(0, 0, 0, '', currentMajor, currentMinor, currentPatch, isTagged);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue