mirror of
https://github.com/renovatebot/renovate.git
synced 2025-01-11 22:46:27 +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}}}',
|
||||
'New value': '{{{newValue}}}',
|
||||
Change: '`{{{displayFrom}}}` -> `{{{displayTo}}}`',
|
||||
Pending: '{{{displayPending}}}',
|
||||
References: '{{{references}}}',
|
||||
'Package file': '{{{packageFile}}}',
|
||||
},
|
||||
|
@ -1982,7 +1983,7 @@ const options: RenovateOptions[] = [
|
|||
description: 'List of columns to use in PR bodies.',
|
||||
type: 'array',
|
||||
subType: 'string',
|
||||
default: ['Package', 'Type', 'Update', 'Change'],
|
||||
default: ['Package', 'Type', 'Update', 'Change', 'Pending'],
|
||||
},
|
||||
{
|
||||
name: 'prBodyNotes',
|
||||
|
|
|
@ -77,6 +77,7 @@ export const allowedFields = {
|
|||
'The depName field sanitized for use in branches after removing spaces and special characters',
|
||||
depType: 'The dependency type (if extracted - manager-dependent)',
|
||||
displayFrom: 'The current value, formatted for display',
|
||||
displayPending: 'Latest pending update, if internalChecksFilter is in use',
|
||||
displayTo: 'The to value, formatted for display',
|
||||
hasReleaseNotes: 'true if the upgrade has release notes',
|
||||
isLockfileUpdate: 'true if the branch is a lock file update',
|
||||
|
|
|
@ -13,6 +13,7 @@ Object {
|
|||
"dependencyDashboardApproval": false,
|
||||
"dependencyDashboardPrApproval": false,
|
||||
"displayFrom": "",
|
||||
"displayPending": "",
|
||||
"displayTo": "0.6.0",
|
||||
"labels": Array [
|
||||
"a",
|
||||
|
@ -30,6 +31,7 @@ Object {
|
|||
"commitMessage": "",
|
||||
"depName": "some-dep",
|
||||
"displayFrom": "",
|
||||
"displayPending": "",
|
||||
"displayTo": "0.6.0",
|
||||
"labels": Array [
|
||||
"a",
|
||||
|
@ -46,6 +48,7 @@ Object {
|
|||
"datasource": "npm",
|
||||
"depName": "some-dep",
|
||||
"displayFrom": "",
|
||||
"displayPending": "",
|
||||
"displayTo": "1.0.0",
|
||||
"labels": Array [
|
||||
"a",
|
||||
|
@ -60,6 +63,7 @@ Object {
|
|||
"commitMessage": "",
|
||||
"depName": "@types/some-dep",
|
||||
"displayFrom": "",
|
||||
"displayPending": "",
|
||||
"displayTo": "0.5.7",
|
||||
"labels": Array [
|
||||
"a",
|
||||
|
@ -85,6 +89,7 @@ Object {
|
|||
"dependencyDashboardApproval": false,
|
||||
"dependencyDashboardPrApproval": false,
|
||||
"displayFrom": "",
|
||||
"displayPending": "",
|
||||
"displayTo": "0.6.0",
|
||||
"hasTypes": true,
|
||||
"isRange": false,
|
||||
|
@ -103,6 +108,7 @@ Object {
|
|||
"datasource": "npm",
|
||||
"depName": "some-dep",
|
||||
"displayFrom": "",
|
||||
"displayPending": "",
|
||||
"displayTo": "0.6.0",
|
||||
"isRange": false,
|
||||
"newValue": "0.6.0",
|
||||
|
@ -117,6 +123,7 @@ Object {
|
|||
"datasource": "npm",
|
||||
"depName": "some-dep",
|
||||
"displayFrom": "",
|
||||
"displayPending": "",
|
||||
"displayTo": "1.0.0",
|
||||
"isRange": false,
|
||||
"newValue": "1.0.0",
|
||||
|
@ -132,6 +139,7 @@ Object {
|
|||
"datasource": "npm",
|
||||
"depName": "@types/some-dep",
|
||||
"displayFrom": "0.5.7",
|
||||
"displayPending": "",
|
||||
"displayTo": "0.5.8",
|
||||
"isRange": false,
|
||||
"newValue": "0.5.8",
|
||||
|
@ -153,6 +161,7 @@ Object {
|
|||
"dependencyDashboardApproval": false,
|
||||
"dependencyDashboardPrApproval": false,
|
||||
"displayFrom": "",
|
||||
"displayPending": "",
|
||||
"displayTo": "",
|
||||
"isLockFileMaintenance": true,
|
||||
"labels": Array [],
|
||||
|
@ -165,6 +174,7 @@ Object {
|
|||
"branchName": "some-branch",
|
||||
"commitMessage": "",
|
||||
"displayFrom": "",
|
||||
"displayPending": "",
|
||||
"displayTo": "",
|
||||
"isLockFileMaintenance": true,
|
||||
"prTitle": "some-title",
|
||||
|
@ -186,6 +196,7 @@ Object {
|
|||
"dependencyDashboardApproval": false,
|
||||
"dependencyDashboardPrApproval": false,
|
||||
"displayFrom": "1.0.0",
|
||||
"displayPending": "",
|
||||
"displayTo": "1.0.1",
|
||||
"isLockfileUpdate": true,
|
||||
"isRange": false,
|
||||
|
@ -204,6 +215,7 @@ Object {
|
|||
"currentValue": "^1.0.0",
|
||||
"currentVersion": "1.0.0",
|
||||
"displayFrom": "1.0.0",
|
||||
"displayPending": "",
|
||||
"displayTo": "1.0.1",
|
||||
"isLockfileUpdate": true,
|
||||
"isRange": false,
|
||||
|
|
|
@ -657,5 +657,35 @@ describe('workers/repository/updates/generate', () => {
|
|||
expect(res.pendingChecks).toBeUndefined();
|
||||
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.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.depType || 'dependency';
|
||||
if (useGroupSettings) {
|
||||
|
|
Loading…
Reference in a new issue