Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use all commits since last none rc tag #62

Merged
merged 5 commits into from
Nov 23, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 10 additions & 14 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,27 +122,23 @@ export async function run({
);

// if the lastest tag is an RC and the next version should be the actual release,
// we need to include the commits between the first RC and the release branch
// we need to include the all commits since the last none RC version and the release branch
anbraten marked this conversation as resolved.
Show resolved Hide resolved
if (semver.prerelease(latestTag) !== null && !shouldBeRC) {
const versionWithoutRc = latestTag.replace(/-\w+.\d+/, "");
const latestRCTags = tags.all
.filter((t) => semver.prerelease(t) !== null)
.filter((t) => t.includes(versionWithoutRc))
.sort(semver.compare);

if (latestRCTags.length > 0) {
const firstRCTag = latestRCTags[0];
const latestNoneRCTags = tags.all
.filter((t) => semver.valid(t) && semver.prerelease(t) === null)
.sort(semver.rcompare);

if (latestNoneRCTags.length > 0) {
const firstNoneRCTag = latestNoneRCTags[0];
console.log(
"# First pre-release tag is:",
c.green(firstRCTag),
"adding commits between",
c.green(firstRCTag),
"# Adding commits since last none rc tag:",
c.green(firstNoneRCTag),
"and",
c.green(releaseBranch)
);

unTaggedCommits = await git.log({
from: firstRCTag,
from: firstNoneRCTag,
to: releaseBranch,
symmetric: false,
});
Expand Down