mirror of
https://github.com/PaulHatch/semantic-version.git
synced 2025-12-27 04:58:17 +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
16
dist/index.js
vendored
16
dist/index.js
vendored
|
|
@ -885,6 +885,7 @@ class DefaultLastReleaseResolver {
|
|||
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/';
|
||||
|
|
@ -892,16 +893,16 @@ class DefaultLastReleaseResolver {
|
|||
// 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 = yield (0, CommandRunner_1.cmd)(command);
|
||||
tag = tag
|
||||
.split('\n')
|
||||
const tags = (yield (0, CommandRunner_1.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 = yield (0, CommandRunner_1.cmd)(command);
|
||||
const tags = (yield (0, CommandRunner_1.cmd)(command)).split('\n');
|
||||
tagsCount = tags.length;
|
||||
tag = tags
|
||||
.split('\n')
|
||||
.find(t => tagFormatter.IsValid(t)) || '';
|
||||
}
|
||||
tag = tag.trim();
|
||||
|
|
@ -914,8 +915,13 @@ class DefaultLastReleaseResolver {
|
|||
// Since there is no remote, we assume that there are no other tags to pull. In
|
||||
// practice this isn't likely to happen, but it keeps the test output from being
|
||||
// polluted with a bunch of warnings.
|
||||
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_1.ReleaseInformation(0, 0, 0, '', currentMajor, currentMinor, currentPatch, isTagged);
|
||||
}
|
||||
|
|
|
|||
2
dist/index.js.map
vendored
2
dist/index.js.map
vendored
File diff suppressed because one or more lines are too long
|
|
@ -48,6 +48,7 @@ class DefaultLastReleaseResolver {
|
|||
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/';
|
||||
|
|
@ -55,16 +56,16 @@ class DefaultLastReleaseResolver {
|
|||
// 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 = yield (0, CommandRunner_1.cmd)(command);
|
||||
tag = tag
|
||||
.split('\n')
|
||||
const tags = (yield (0, CommandRunner_1.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 = yield (0, CommandRunner_1.cmd)(command);
|
||||
const tags = (yield (0, CommandRunner_1.cmd)(command)).split('\n');
|
||||
tagsCount = tags.length;
|
||||
tag = tags
|
||||
.split('\n')
|
||||
.find(t => tagFormatter.IsValid(t)) || '';
|
||||
}
|
||||
tag = tag.trim();
|
||||
|
|
@ -77,8 +78,13 @@ class DefaultLastReleaseResolver {
|
|||
// Since there is no remote, we assume that there are no other tags to pull. In
|
||||
// practice this isn't likely to happen, but it keeps the test output from being
|
||||
// polluted with a bunch of warnings.
|
||||
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_1.ReleaseInformation(0, 0, 0, '', currentMajor, currentMinor, currentPatch, isTagged);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,6 +27,8 @@ export class DefaultLastReleaseResolver implements LastReleaseResolver {
|
|||
|
||||
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,8 +62,12 @@ 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.
|
||||
|
||||
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…
Reference in a new issue