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

feat: conventional commit plugin will label an unlabeled PR #1758

Merged
merged 5 commits into from Feb 3, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion packages/core/src/auto.ts
Expand Up @@ -2226,7 +2226,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));
}