Skip to content

Commit

Permalink
fix(prerelease): only show full changelog diff if elevating from a pr…
Browse files Browse the repository at this point in the history
…erelease
  • Loading branch information
Machine-Maker committed Sep 6, 2021
1 parent 2e3dc75 commit 76c09bb
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion dist/main.js

Large diffs are not rendered by default.

12 changes: 12 additions & 0 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import semverValid from "semver/functions/valid"
import semverRcompare from "semver/functions/rcompare"
import semverLt from "semver/functions/lt"
import semverDiff from "semver/functions/diff"
import semverPrerelease from "semver/functions/prerelease"
import {generateChangelogFromParsedCommits, getChangelogOptions, isBreakingChange, ParsedCommits} from "./changelog"
import {getClosedIssues} from "./graphql"
import globby from "globby"
Expand Down Expand Up @@ -83,6 +84,17 @@ const searchForPreviousReleaseTag = async (
core.info(`Finding previous tag from list: ${JSON.stringify(tagList.map(tag => tag.name))}`)
let previousReleaseTag = null;
for (const tag of tagList) {
if (semverLt(tag.semverTag, currentReleaseTag)) {
if (!skipPreReleases || semverDiff(tag.semverTag, currentReleaseTag) !== 'prerelease') {
previousReleaseTag = tag;
break;
} else {
if (semverPrerelease(tag.semverTag) != null) {
previousReleaseTag = tag;
break;
}
}
}
if (semverLt(tag.semverTag, currentReleaseTag) && (!skipPreReleases || semverDiff(tag.semverTag, currentReleaseTag) !== "prerelease")) {
previousReleaseTag = tag;
break;
Expand Down

0 comments on commit 76c09bb

Please sign in to comment.