Skip to content

Commit

Permalink
feat: updateType=patch (#9393)
Browse files Browse the repository at this point in the history
Changes behavior so that patch updateType is not rewritten to minor by default.

Closes #2818

BREAKING CHANGE: patch updates are not considered updateType=minor by default.
  • Loading branch information
rarkins committed Apr 22, 2021
1 parent 13bbc5d commit 0500042
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 47 deletions.
1 change: 0 additions & 1 deletion docs/usage/configuration-options.md
Expand Up @@ -1517,7 +1517,6 @@ For example to apply a special label for Major updates:
## patch

Add to this object if you wish to define rules that apply only to patch updates.
Only applies if `separateMinorPatch` is set to true.

## php

Expand Down
5 changes: 1 addition & 4 deletions docs/usage/faq.md
Expand Up @@ -208,10 +208,7 @@ To learn more read the section below.

You can see in the example above that Renovate won't normally open a PR for the `snorgleborf` patch release.

There are 2 ways to tell Renovate to open a separate PR for the patch release:

- Set `separateMinorPatch` to `true`
- Set `automerge` to the value: `"patch"`
You can tell Renovate to open a separate PR for the patch release by setting `separateMinorPatch` to `true`.

In both cases, Renovate will open 3 PRs:

Expand Down
3 changes: 1 addition & 2 deletions lib/config/definitions.ts
Expand Up @@ -1077,8 +1077,7 @@ const options: RenovateOptions[] = [
},
{
name: 'patch',
description:
'Configuration to apply when an update type is patch. Only applies if `separateMinorPatch` is set to true.',
description: 'Configuration to apply when an update type is patch.',
stage: 'package',
type: 'object',
default: {},
Expand Down
Expand Up @@ -50,7 +50,7 @@ Array [
"newValue": "==0.9.7",
"newVersion": "0.9.7",
"releaseTimestamp": "2013-09-04T17:07:22.948Z",
"updateType": "minor",
"updateType": "patch",
},
Object {
"bucket": "major",
Expand Down Expand Up @@ -446,30 +446,7 @@ Array [
"newValue": "0.9.7",
"newVersion": "0.9.7",
"releaseTimestamp": "2013-09-04T17:07:22.948Z",
"updateType": "minor",
},
Object {
"bucket": "major",
"newMajor": 1,
"newMinor": 4,
"newValue": "1.4.1",
"newVersion": "1.4.1",
"releaseTimestamp": "2015-05-17T04:25:07.299Z",
"updateType": "major",
},
]
`;
exports[`workers/repository/process/lookup/index .lookupUpdates() returns minor update if separate patches not configured 1`] = `
Array [
Object {
"bucket": "non-major",
"newMajor": 0,
"newMinor": 9,
"newValue": "0.9.7",
"newVersion": "0.9.7",
"releaseTimestamp": "2013-09-04T17:07:22.948Z",
"updateType": "minor",
"updateType": "patch",
},
Object {
"bucket": "major",
Expand Down Expand Up @@ -552,6 +529,29 @@ Array [
]
`;
exports[`workers/repository/process/lookup/index .lookupUpdates() returns patch update even if separate patches not configured 1`] = `
Array [
Object {
"bucket": "non-major",
"newMajor": 0,
"newMinor": 9,
"newValue": "0.9.7",
"newVersion": "0.9.7",
"releaseTimestamp": "2013-09-04T17:07:22.948Z",
"updateType": "patch",
},
Object {
"bucket": "major",
"newMajor": 1,
"newMinor": 4,
"newValue": "1.4.1",
"newVersion": "1.4.1",
"releaseTimestamp": "2015-05-17T04:25:07.299Z",
"updateType": "major",
},
]
`;
exports[`workers/repository/process/lookup/index .lookupUpdates() returns patch update if separateMinorPatch 1`] = `
Array [
Object {
Expand Down Expand Up @@ -617,7 +617,7 @@ Array [
"newValue": "3.1.0-dev.20180813",
"newVersion": "3.1.0-dev.20180813",
"releaseTimestamp": "2018-08-13T19:05:14.347Z",
"updateType": "minor",
"updateType": "patch",
},
]
`;
Expand All @@ -631,7 +631,7 @@ Array [
"newValue": "2.5.17-beta.0",
"newVersion": "2.5.17-beta.0",
"releaseTimestamp": "2018-03-23T23:29:13.819Z",
"updateType": "minor",
"updateType": "patch",
},
]
`;
Expand All @@ -655,7 +655,7 @@ Array [
"newValue": "3.0.1-insiders.20180726",
"newVersion": "3.0.1-insiders.20180726",
"releaseTimestamp": "2018-07-26T18:20:51.679Z",
"updateType": "minor",
"updateType": "patch",
},
]
`;
Expand All @@ -682,7 +682,7 @@ Array [
"newValue": "3.0.1-insiders.20180726",
"newVersion": "3.0.1-insiders.20180726",
"releaseTimestamp": "2018-07-26T18:20:51.679Z",
"updateType": "minor",
"updateType": "patch",
},
]
`;
Expand All @@ -696,7 +696,7 @@ Array [
"newValue": "3.0.1",
"newVersion": "3.0.1",
"releaseTimestamp": "2018-07-30T16:21:13.150Z",
"updateType": "minor",
"updateType": "patch",
},
]
`;
Expand All @@ -723,7 +723,7 @@ Array [
"newValue": "^0.0.35",
"newVersion": "0.0.35",
"releaseTimestamp": "2017-04-27T16:59:06.479Z",
"updateType": "minor",
"updateType": "patch",
},
]
`;
Expand Down Expand Up @@ -1503,7 +1503,7 @@ Array [
"newValue": "1.0.1",
"newVersion": "1.0.1",
"releaseTimestamp": "2014-03-11T18:47:17.560Z",
"updateType": "minor",
"updateType": "patch",
},
]
`;
Expand Down
8 changes: 4 additions & 4 deletions lib/workers/repository/process/lookup/index.spec.ts
Expand Up @@ -186,7 +186,7 @@ describe(getName(__filename), () => {
Error(CONFIG_VALIDATION)
);
});
it('returns minor update if separate patches not configured', async () => {
it('returns patch update even if separate patches not configured', async () => {
config.currentValue = '0.9.0';
config.rangeStrategy = 'pin';
config.depName = 'q';
Expand All @@ -195,8 +195,8 @@ describe(getName(__filename), () => {
const res = await lookup.lookupUpdates(config);
expect(res.updates).toMatchSnapshot();
expect(res.updates).toHaveLength(2);
expect(res.updates[0].updateType).not.toEqual('patch');
expect(res.updates[1].updateType).not.toEqual('patch');
expect(res.updates[0].updateType).toEqual('patch');
expect(res.updates[1].updateType).toEqual('major');
});
it('returns minor update if automerging both patch and minor', async () => {
config.patch = {
Expand All @@ -212,7 +212,7 @@ describe(getName(__filename), () => {
nock('https://registry.npmjs.org').get('/q').reply(200, qJson);
const res = await lookup.lookupUpdates(config);
expect(res.updates).toMatchSnapshot();
expect(res.updates[0].updateType).toEqual('minor');
expect(res.updates[0].updateType).toEqual('patch');
});
it('returns patch update if separateMinorPatch', async () => {
config.separateMinorPatch = true;
Expand Down
5 changes: 1 addition & 4 deletions lib/workers/repository/process/lookup/update-type.ts
Expand Up @@ -19,8 +19,5 @@ export function getUpdateType(
if (versioning.getMinor(newVersion) > versioning.getMinor(currentVersion)) {
return 'minor';
}
if (config.separateMinorPatch) {
return 'patch';
}
return 'minor';
return 'patch';
}

0 comments on commit 0500042

Please sign in to comment.