Skip to content

Commit

Permalink
Merge pull request #1758 from hborawski/conventional-labels
Browse files Browse the repository at this point in the history
feat: conventional commit plugin will label an unlabeled PR
  • Loading branch information
hipstersmoothie committed Feb 3, 2021
2 parents 1d01fd3 + a9e87c0 commit a66eb87
Show file tree
Hide file tree
Showing 5 changed files with 538 additions and 287 deletions.
3 changes: 2 additions & 1 deletion packages/core/src/auto.ts
Expand Up @@ -2230,7 +2230,8 @@ export { IPlugin } from "./utils/load-plugins";
export { ICommitAuthor, IExtendedCommit } from "./log-parse";

export { default as Auto } from "./auto";
export { default as SEMVER, VersionLabel } from "./semver";
export { default as SEMVER } from "./semver";
export * from "./semver";
export { default as execPromise } from "./utils/exec-promise";
export {
default as getLernaPackages,
Expand Down
8 changes: 4 additions & 4 deletions packages/core/src/semver.ts
Expand Up @@ -164,7 +164,7 @@ export function getHigherSemverTag(left: SEMVER, right: SEMVER): SEMVER {
}

/** Get the semver bump for a release type */
const getBump = (releaseType?: ReleaseType) =>
export const getReleaseType = (releaseType?: ReleaseType) =>
releaseType === "none" || releaseType === "skip"
? SEMVER.noVersion
: releaseType === "release"
Expand Down Expand Up @@ -202,7 +202,7 @@ export function calculateSemVerBump(
// 2. It has labels but none of them are auto labels
if (
index === 0 &&
(pr.length === 0 || !pr.find((label) => getLabelEntry(label)))
(pr.length === 0 || !pr.some((label) => Boolean(getLabelEntry(label))))
) {
releaseTypes.add(defaultReleaseType);
}
Expand Down Expand Up @@ -238,6 +238,6 @@ export function calculateSemVerBump(
}

return [...releaseTypes]
.map(getBump)
.reduce(getHigherSemverTag, getBump(defaultReleaseType));
.map(getReleaseType)
.reduce(getHigherSemverTag, getReleaseType(defaultReleaseType));
}

0 comments on commit a66eb87

Please sign in to comment.