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: updateType=patch #9393

Merged
merged 1 commit into from Apr 4, 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
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 @@ -1049,8 +1049,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
12 changes: 12 additions & 0 deletions lib/config/presets/internal/group.ts
Expand Up @@ -499,6 +499,9 @@ const staticGroups = {
minor: {
groupName: 'JS unit test packages',
},
patch: {
groupName: 'JS unit test packages',
},
},
],
},
Expand All @@ -519,6 +522,9 @@ const staticGroups = {
minor: {
groupName: 'unit test packages',
},
patch: {
groupName: 'unit test packages',
},
},
],
},
Expand All @@ -539,6 +545,9 @@ const staticGroups = {
minor: {
groupName: 'JS test packages',
},
patch: {
groupName: 'JS test packages',
},
},
],
},
Expand All @@ -559,6 +568,9 @@ const staticGroups = {
minor: {
groupName: 'test packages',
},
patch: {
groupName: 'test packages',
},
},
],
},
Expand Down
110 changes: 55 additions & 55 deletions lib/workers/repository/process/lookup/__snapshots__/index.spec.ts.snap
Expand Up @@ -112,7 +112,7 @@ Array [
"0.9.5",
"0.9.6",
],
"updateType": "minor",
"updateType": "patch",
},
Object {
"blockedByPin": true,
Expand Down Expand Up @@ -705,53 +705,7 @@ Array [
"0.9.5",
"0.9.6",
],
"updateType": "minor",
},
Object {
"bucket": "major",
"currentVersion": "0.9.0",
"isSingleVersion": true,
"newMajor": 1,
"newMinor": 4,
"newValue": "1.4.1",
"newVersion": "1.4.1",
"releaseTimestamp": "2015-05-17T04:25:07.299Z",
"skippedOverVersions": Array [
"1.0.0",
"1.0.1",
"1.1.0",
"1.1.1",
"1.1.2",
"1.2.0",
"1.2.1",
"1.3.0",
"1.4.0",
],
"updateType": "major",
},
]
`;

exports[`workers/repository/process/lookup .lookupUpdates() returns minor update if separate patches not configured 1`] = `
Array [
Object {
"bucket": "non-major",
"currentVersion": "0.9.0",
"isSingleVersion": true,
"newMajor": 0,
"newMinor": 9,
"newValue": "0.9.7",
"newVersion": "0.9.7",
"releaseTimestamp": "2013-09-04T17:07:22.948Z",
"skippedOverVersions": Array [
"0.9.1",
"0.9.2",
"0.9.3",
"0.9.4",
"0.9.5",
"0.9.6",
],
"updateType": "minor",
"updateType": "patch",
},
Object {
"bucket": "major",
Expand Down Expand Up @@ -979,6 +933,52 @@ Array [
]
`;

exports[`workers/repository/process/lookup .lookupUpdates() returns patch update even if separate patches not configured 1`] = `
Array [
Object {
"bucket": "non-major",
"currentVersion": "0.9.0",
"isSingleVersion": true,
"newMajor": 0,
"newMinor": 9,
"newValue": "0.9.7",
"newVersion": "0.9.7",
"releaseTimestamp": "2013-09-04T17:07:22.948Z",
"skippedOverVersions": Array [
"0.9.1",
"0.9.2",
"0.9.3",
"0.9.4",
"0.9.5",
"0.9.6",
],
"updateType": "patch",
},
Object {
"bucket": "major",
"currentVersion": "0.9.0",
"isSingleVersion": true,
"newMajor": 1,
"newMinor": 4,
"newValue": "1.4.1",
"newVersion": "1.4.1",
"releaseTimestamp": "2015-05-17T04:25:07.299Z",
"skippedOverVersions": Array [
"1.0.0",
"1.0.1",
"1.1.0",
"1.1.1",
"1.1.2",
"1.2.0",
"1.2.1",
"1.3.0",
"1.4.0",
],
"updateType": "major",
},
]
`;

exports[`workers/repository/process/lookup .lookupUpdates() returns patch update if separateMinorPatch 1`] = `
Array [
Object {
Expand Down Expand Up @@ -1096,7 +1096,7 @@ Array [
"3.1.0-dev.20180809",
"3.1.0-dev.20180810",
],
"updateType": "minor",
"updateType": "patch",
},
]
`;
Expand All @@ -1112,7 +1112,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 Down Expand Up @@ -1140,7 +1140,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 Down Expand Up @@ -1171,7 +1171,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 @@ -1187,7 +1187,7 @@ Array [
"newValue": "3.0.1",
"newVersion": "3.0.1",
"releaseTimestamp": "2018-07-30T16:21:13.150Z",
"updateType": "minor",
"updateType": "patch",
},
]
`;
Expand Down Expand Up @@ -1218,7 +1218,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 @@ -2648,7 +2648,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('workers/repository/process/lookup', () => {
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('workers/repository/process/lookup', () => {
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('workers/repository/process/lookup', () => {
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';
}