mirror of
https://github.com/renovatebot/renovate.git
synced 2025-01-12 06:56:24 +00:00
feat(pr): display latest pending update in upgrades table (#13768)
This commit is contained in:
parent
f579f4775c
commit
2e35968146
5 changed files with 54 additions and 1 deletions
|
@ -1973,6 +1973,7 @@ const options: RenovateOptions[] = [
|
||||||
'Current value': '{{{currentValue}}}',
|
'Current value': '{{{currentValue}}}',
|
||||||
'New value': '{{{newValue}}}',
|
'New value': '{{{newValue}}}',
|
||||||
Change: '`{{{displayFrom}}}` -> `{{{displayTo}}}`',
|
Change: '`{{{displayFrom}}}` -> `{{{displayTo}}}`',
|
||||||
|
Pending: '{{{displayPending}}}',
|
||||||
References: '{{{references}}}',
|
References: '{{{references}}}',
|
||||||
'Package file': '{{{packageFile}}}',
|
'Package file': '{{{packageFile}}}',
|
||||||
},
|
},
|
||||||
|
@ -1982,7 +1983,7 @@ const options: RenovateOptions[] = [
|
||||||
description: 'List of columns to use in PR bodies.',
|
description: 'List of columns to use in PR bodies.',
|
||||||
type: 'array',
|
type: 'array',
|
||||||
subType: 'string',
|
subType: 'string',
|
||||||
default: ['Package', 'Type', 'Update', 'Change'],
|
default: ['Package', 'Type', 'Update', 'Change', 'Pending'],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'prBodyNotes',
|
name: 'prBodyNotes',
|
||||||
|
|
|
@ -77,6 +77,7 @@ export const allowedFields = {
|
||||||
'The depName field sanitized for use in branches after removing spaces and special characters',
|
'The depName field sanitized for use in branches after removing spaces and special characters',
|
||||||
depType: 'The dependency type (if extracted - manager-dependent)',
|
depType: 'The dependency type (if extracted - manager-dependent)',
|
||||||
displayFrom: 'The current value, formatted for display',
|
displayFrom: 'The current value, formatted for display',
|
||||||
|
displayPending: 'Latest pending update, if internalChecksFilter is in use',
|
||||||
displayTo: 'The to value, formatted for display',
|
displayTo: 'The to value, formatted for display',
|
||||||
hasReleaseNotes: 'true if the upgrade has release notes',
|
hasReleaseNotes: 'true if the upgrade has release notes',
|
||||||
isLockfileUpdate: 'true if the branch is a lock file update',
|
isLockfileUpdate: 'true if the branch is a lock file update',
|
||||||
|
|
|
@ -13,6 +13,7 @@ Object {
|
||||||
"dependencyDashboardApproval": false,
|
"dependencyDashboardApproval": false,
|
||||||
"dependencyDashboardPrApproval": false,
|
"dependencyDashboardPrApproval": false,
|
||||||
"displayFrom": "",
|
"displayFrom": "",
|
||||||
|
"displayPending": "",
|
||||||
"displayTo": "0.6.0",
|
"displayTo": "0.6.0",
|
||||||
"labels": Array [
|
"labels": Array [
|
||||||
"a",
|
"a",
|
||||||
|
@ -30,6 +31,7 @@ Object {
|
||||||
"commitMessage": "",
|
"commitMessage": "",
|
||||||
"depName": "some-dep",
|
"depName": "some-dep",
|
||||||
"displayFrom": "",
|
"displayFrom": "",
|
||||||
|
"displayPending": "",
|
||||||
"displayTo": "0.6.0",
|
"displayTo": "0.6.0",
|
||||||
"labels": Array [
|
"labels": Array [
|
||||||
"a",
|
"a",
|
||||||
|
@ -46,6 +48,7 @@ Object {
|
||||||
"datasource": "npm",
|
"datasource": "npm",
|
||||||
"depName": "some-dep",
|
"depName": "some-dep",
|
||||||
"displayFrom": "",
|
"displayFrom": "",
|
||||||
|
"displayPending": "",
|
||||||
"displayTo": "1.0.0",
|
"displayTo": "1.0.0",
|
||||||
"labels": Array [
|
"labels": Array [
|
||||||
"a",
|
"a",
|
||||||
|
@ -60,6 +63,7 @@ Object {
|
||||||
"commitMessage": "",
|
"commitMessage": "",
|
||||||
"depName": "@types/some-dep",
|
"depName": "@types/some-dep",
|
||||||
"displayFrom": "",
|
"displayFrom": "",
|
||||||
|
"displayPending": "",
|
||||||
"displayTo": "0.5.7",
|
"displayTo": "0.5.7",
|
||||||
"labels": Array [
|
"labels": Array [
|
||||||
"a",
|
"a",
|
||||||
|
@ -85,6 +89,7 @@ Object {
|
||||||
"dependencyDashboardApproval": false,
|
"dependencyDashboardApproval": false,
|
||||||
"dependencyDashboardPrApproval": false,
|
"dependencyDashboardPrApproval": false,
|
||||||
"displayFrom": "",
|
"displayFrom": "",
|
||||||
|
"displayPending": "",
|
||||||
"displayTo": "0.6.0",
|
"displayTo": "0.6.0",
|
||||||
"hasTypes": true,
|
"hasTypes": true,
|
||||||
"isRange": false,
|
"isRange": false,
|
||||||
|
@ -103,6 +108,7 @@ Object {
|
||||||
"datasource": "npm",
|
"datasource": "npm",
|
||||||
"depName": "some-dep",
|
"depName": "some-dep",
|
||||||
"displayFrom": "",
|
"displayFrom": "",
|
||||||
|
"displayPending": "",
|
||||||
"displayTo": "0.6.0",
|
"displayTo": "0.6.0",
|
||||||
"isRange": false,
|
"isRange": false,
|
||||||
"newValue": "0.6.0",
|
"newValue": "0.6.0",
|
||||||
|
@ -117,6 +123,7 @@ Object {
|
||||||
"datasource": "npm",
|
"datasource": "npm",
|
||||||
"depName": "some-dep",
|
"depName": "some-dep",
|
||||||
"displayFrom": "",
|
"displayFrom": "",
|
||||||
|
"displayPending": "",
|
||||||
"displayTo": "1.0.0",
|
"displayTo": "1.0.0",
|
||||||
"isRange": false,
|
"isRange": false,
|
||||||
"newValue": "1.0.0",
|
"newValue": "1.0.0",
|
||||||
|
@ -132,6 +139,7 @@ Object {
|
||||||
"datasource": "npm",
|
"datasource": "npm",
|
||||||
"depName": "@types/some-dep",
|
"depName": "@types/some-dep",
|
||||||
"displayFrom": "0.5.7",
|
"displayFrom": "0.5.7",
|
||||||
|
"displayPending": "",
|
||||||
"displayTo": "0.5.8",
|
"displayTo": "0.5.8",
|
||||||
"isRange": false,
|
"isRange": false,
|
||||||
"newValue": "0.5.8",
|
"newValue": "0.5.8",
|
||||||
|
@ -153,6 +161,7 @@ Object {
|
||||||
"dependencyDashboardApproval": false,
|
"dependencyDashboardApproval": false,
|
||||||
"dependencyDashboardPrApproval": false,
|
"dependencyDashboardPrApproval": false,
|
||||||
"displayFrom": "",
|
"displayFrom": "",
|
||||||
|
"displayPending": "",
|
||||||
"displayTo": "",
|
"displayTo": "",
|
||||||
"isLockFileMaintenance": true,
|
"isLockFileMaintenance": true,
|
||||||
"labels": Array [],
|
"labels": Array [],
|
||||||
|
@ -165,6 +174,7 @@ Object {
|
||||||
"branchName": "some-branch",
|
"branchName": "some-branch",
|
||||||
"commitMessage": "",
|
"commitMessage": "",
|
||||||
"displayFrom": "",
|
"displayFrom": "",
|
||||||
|
"displayPending": "",
|
||||||
"displayTo": "",
|
"displayTo": "",
|
||||||
"isLockFileMaintenance": true,
|
"isLockFileMaintenance": true,
|
||||||
"prTitle": "some-title",
|
"prTitle": "some-title",
|
||||||
|
@ -186,6 +196,7 @@ Object {
|
||||||
"dependencyDashboardApproval": false,
|
"dependencyDashboardApproval": false,
|
||||||
"dependencyDashboardPrApproval": false,
|
"dependencyDashboardPrApproval": false,
|
||||||
"displayFrom": "1.0.0",
|
"displayFrom": "1.0.0",
|
||||||
|
"displayPending": "",
|
||||||
"displayTo": "1.0.1",
|
"displayTo": "1.0.1",
|
||||||
"isLockfileUpdate": true,
|
"isLockfileUpdate": true,
|
||||||
"isRange": false,
|
"isRange": false,
|
||||||
|
@ -204,6 +215,7 @@ Object {
|
||||||
"currentValue": "^1.0.0",
|
"currentValue": "^1.0.0",
|
||||||
"currentVersion": "1.0.0",
|
"currentVersion": "1.0.0",
|
||||||
"displayFrom": "1.0.0",
|
"displayFrom": "1.0.0",
|
||||||
|
"displayPending": "",
|
||||||
"displayTo": "1.0.1",
|
"displayTo": "1.0.1",
|
||||||
"isLockfileUpdate": true,
|
"isLockfileUpdate": true,
|
||||||
"isRange": false,
|
"isRange": false,
|
||||||
|
|
|
@ -657,5 +657,35 @@ describe('workers/repository/updates/generate', () => {
|
||||||
expect(res.pendingChecks).toBeUndefined();
|
expect(res.pendingChecks).toBeUndefined();
|
||||||
expect(res.upgrades).toHaveLength(1);
|
expect(res.upgrades).toHaveLength(1);
|
||||||
});
|
});
|
||||||
|
it('displays pending versions', () => {
|
||||||
|
const branch = [
|
||||||
|
{
|
||||||
|
depName: 'some-dep',
|
||||||
|
groupName: 'some-group',
|
||||||
|
branchName: 'some-branch',
|
||||||
|
prTitle: 'No pending version',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
depName: 'some-dep',
|
||||||
|
groupName: 'some-group',
|
||||||
|
branchName: 'some-branch',
|
||||||
|
prTitle: 'One pending version',
|
||||||
|
pendingVersions: ['1.1.0'],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
depName: 'some-dep',
|
||||||
|
groupName: 'some-group',
|
||||||
|
branchName: 'some-branch',
|
||||||
|
prTitle: 'Two pending versions',
|
||||||
|
pendingVersions: ['1.1.0', '1.1.1'],
|
||||||
|
},
|
||||||
|
];
|
||||||
|
const res = generateBranchConfig(branch);
|
||||||
|
expect(res.upgrades.map((u) => u.displayPending)).toStrictEqual([
|
||||||
|
'',
|
||||||
|
'`1.1.0`',
|
||||||
|
'`1.1.1` (+1)',
|
||||||
|
]);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -124,6 +124,15 @@ export function generateBranchConfig(
|
||||||
}
|
}
|
||||||
upgrade.displayFrom ??= '';
|
upgrade.displayFrom ??= '';
|
||||||
upgrade.displayTo ??= '';
|
upgrade.displayTo ??= '';
|
||||||
|
const pendingVersionsLength = upgrade.pendingVersions?.length;
|
||||||
|
if (pendingVersionsLength) {
|
||||||
|
upgrade.displayPending = `\`${upgrade.pendingVersions.slice(-1).pop()}\``;
|
||||||
|
if (pendingVersionsLength > 1) {
|
||||||
|
upgrade.displayPending += ` (+${pendingVersionsLength - 1})`;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
upgrade.displayPending = '';
|
||||||
|
}
|
||||||
upgrade.prettyDepType =
|
upgrade.prettyDepType =
|
||||||
upgrade.prettyDepType || upgrade.depType || 'dependency';
|
upgrade.prettyDepType || upgrade.depType || 'dependency';
|
||||||
if (useGroupSettings) {
|
if (useGroupSettings) {
|
||||||
|
|
Loading…
Reference in a new issue