mirror of
https://github.com/renovatebot/renovate.git
synced 2025-01-13 07:26:26 +00:00
fix: prPriority
based sorting of prs (#29306)
This commit is contained in:
parent
6dd189e3a6
commit
9e2ca6b152
2 changed files with 12 additions and 2 deletions
|
@ -58,11 +58,16 @@ describe('workers/repository/process/sort', () => {
|
||||||
prTitle: 'a minor update',
|
prTitle: 'a minor update',
|
||||||
prPriority: -1,
|
prPriority: -1,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
updateType: 'patch' as UpdateType,
|
||||||
|
prTitle: 'a patch update',
|
||||||
|
},
|
||||||
];
|
];
|
||||||
sortBranches(branches);
|
sortBranches(branches);
|
||||||
expect(branches).toEqual([
|
expect(branches).toEqual([
|
||||||
{ prPriority: 1, prTitle: 'some major update', updateType: 'major' },
|
{ prPriority: 1, prTitle: 'some major update', updateType: 'major' },
|
||||||
{ prPriority: 0, prTitle: 'some other pin', updateType: 'pin' },
|
{ prPriority: 0, prTitle: 'some other pin', updateType: 'pin' },
|
||||||
|
{ prTitle: 'a patch update', updateType: 'patch' },
|
||||||
{ prPriority: -1, prTitle: 'some pin', updateType: 'pin' },
|
{ prPriority: -1, prTitle: 'some pin', updateType: 'pin' },
|
||||||
{ prPriority: -1, prTitle: 'a minor update', updateType: 'minor' },
|
{ prPriority: -1, prTitle: 'a minor update', updateType: 'minor' },
|
||||||
]);
|
]);
|
||||||
|
|
|
@ -21,8 +21,9 @@ export function sortBranches(branches: Partial<BranchConfig>[]): void {
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO #22198
|
// TODO #22198
|
||||||
if (a.prPriority !== b.prPriority) {
|
const prPriorityDiff = getPrPriority(b) - getPrPriority(a);
|
||||||
return b.prPriority! - a.prPriority!;
|
if (prPriorityDiff !== 0) {
|
||||||
|
return prPriorityDiff;
|
||||||
}
|
}
|
||||||
// TODO #22198
|
// TODO #22198
|
||||||
const sortDiff =
|
const sortDiff =
|
||||||
|
@ -35,3 +36,7 @@ export function sortBranches(branches: Partial<BranchConfig>[]): void {
|
||||||
return a.prTitle! < b.prTitle! ? -1 : 1;
|
return a.prTitle! < b.prTitle! ? -1 : 1;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getPrPriority(branch: Partial<BranchConfig>): number {
|
||||||
|
return branch.prPriority ?? 0;
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue