Skip to content

Commit

Permalink
fix bug where version would be wrong with labelless PRs merged along …
Browse files Browse the repository at this point in the history
…with 'none' release types
  • Loading branch information
hipstersmoothie committed Mar 6, 2020
1 parent 1a223ef commit 46de105
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
6 changes: 6 additions & 0 deletions packages/core/src/__tests__/semver.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ describe('calculateSemVerBump', () => {
).toBe(SEMVER.noVersion);
});

test('should release a patch for unlabeled pr merged along with none releases', () => {
expect(calculateSemVerBump([[], ['documentation']], semverMap)).toBe(
SEMVER.patch
);
});

test('should not skip things before none', () => {
expect(calculateSemVerBump([['none'], ['major']], semverMap)).toBe(
SEMVER.major
Expand Down
7 changes: 6 additions & 1 deletion packages/core/src/semver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,12 @@ export function calculateSemVerBump(
const labelSet = new Set<string>();
const skipReleaseLabels = labelMap.get('skip') || [];

labels.forEach(pr => {
labels.forEach((pr, index) => {
// If the head pr has no labels we default to a patch
if (pr.length === 0 && index === 0) {
labelSet.add(SEMVER.patch);
}

pr.forEach(label => {
const userLabel = [...labelMap.entries()].find(pair =>
pair[1].includes(label)
Expand Down

0 comments on commit 46de105

Please sign in to comment.