Ignore non-version branches, reset diagnostics between tests

This commit is contained in:
Paul Hatcherian 2023-09-30 04:51:49 -04:00
parent cfbfddabdd
commit ec20cad99a
17 changed files with 2358 additions and 1307 deletions

View file

@ -39,15 +39,12 @@ class BumpAlwaysVersionClassifier extends DefaultVersionClassifier_1.DefaultVers
else if (this.minorPattern(commit)) {
type = VersionType_1.VersionType.Minor;
}
else if (this.patchPattern(commit) ||
(major === 0 && minor === 0 && patch === 0 && commitSet.commits.length > 0)) {
type = VersionType_1.VersionType.Patch;
}
else {
if (this.patchPattern(commit) ||
(major === 0 && minor === 0 && patch === 0 && commitSet.commits.length > 0)) {
type = VersionType_1.VersionType.Patch;
}
else {
type = VersionType_1.VersionType.None;
increment++;
}
type = VersionType_1.VersionType.None;
}
if (this.enablePrereleaseMode && major === 0) {
switch (type) {
@ -61,7 +58,9 @@ class BumpAlwaysVersionClassifier extends DefaultVersionClassifier_1.DefaultVers
patch += 1;
increment = 0;
break;
default: break;
default:
increment++;
break;
}
}
else {
@ -80,7 +79,9 @@ class BumpAlwaysVersionClassifier extends DefaultVersionClassifier_1.DefaultVers
patch += 1;
increment = 0;
break;
default: break;
default:
increment++;
break;
}
}
}

View file

@ -32,7 +32,7 @@ class DefaultCurrentCommitResolver {
ResolveBranchNameAsync() {
return __awaiter(this, void 0, void 0, function* () {
const branchName = this.branch == 'HEAD' ?
process.env.GITHUB_REF_NAME || (yield (0, CommandRunner_1.cmd)('git', 'rev-parse', '--abbrev-ref', 'HEAD'))
process.env.GITHUB_REF_NAME || (yield (0, CommandRunner_1.cmd)('git', 'branch', '--show-current'))
: this.branch;
return branchName.trim();
});

View file

@ -96,8 +96,8 @@ class DefaultVersionClassifier {
// - commit 3 was tagged v2.0.0 - v2.0.0+0
// - commit 4 - v2.0.1+0
const versionsMatch = lastRelease.currentMajor === major && lastRelease.currentMinor === minor && lastRelease.currentPatch === patch;
const currentIncremement = versionsMatch ? increment : 0;
return new VersionClassification_1.VersionClassification(VersionType_1.VersionType.None, currentIncremement, false, lastRelease.currentMajor, lastRelease.currentMinor, lastRelease.currentPatch);
const currentIncrement = versionsMatch ? increment : 0;
return new VersionClassification_1.VersionClassification(VersionType_1.VersionType.None, currentIncrement, false, lastRelease.currentMajor, lastRelease.currentMinor, lastRelease.currentPatch);
}
return new VersionClassification_1.VersionClassification(type, increment, changed, major, minor, patch);
});

View file

@ -12,4 +12,4 @@ var VersionType;
VersionType["Patch"] = "Patch";
/** Indicates no change--generally this means that the current commit is already tagged with a version */
VersionType["None"] = "None";
})(VersionType = exports.VersionType || (exports.VersionType = {}));
})(VersionType || (exports.VersionType = VersionType = {}));