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(packageRules): add merge confidence matcher #21049

Merged
merged 13 commits into from
Mar 21, 2023
32 changes: 32 additions & 0 deletions docs/usage/configuration-options.md
Original file line number Diff line number Diff line change
Expand Up @@ -2135,6 +2135,38 @@ For example to apply a special label for Major updates:
}
```

### matchConfidence

<!-- prettier-ignore -->
!!! warning
This configuration option is dependent on an API key, therefore it is effectively disabled if none is set.
rarkins marked this conversation as resolved.
Show resolved Hide resolved

For example to group high merge confidence updates:

```json
{
"packageRules": [
{
"matchConfidence": ["high", "very high"],
"groupName": "high merge confidence"
}
]
}
```

This feature requires an API token. Set it via Host rules under the `merge-confidence` HostType:
rarkins marked this conversation as resolved.
Show resolved Hide resolved
rarkins marked this conversation as resolved.
Show resolved Hide resolved

```json
{
"hostRules": [
{
"hostType": "merge-confidence",
"token": "********"
}
]
}
```

### customChangelogUrl

Use this field to set the source URL for a package, including overriding an existing one.
Expand Down
4 changes: 4 additions & 0 deletions docs/usage/self-hosted-experimental.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ When using `matchPackageNames` and `matchPackagePatterns` matchers:
1. Renovate first tries to match against `depName`
2. If `depName` doesn't match then Renovate tries to match against `packageName`

## `RENOVATE_X_MERGE_CONFIDENCE_API_BASE_URL`

If set, Renovate will query this api for Merge Confidence data.
rarkins marked this conversation as resolved.
Show resolved Hide resolved
rarkins marked this conversation as resolved.
Show resolved Hide resolved

## `RENOVATE_X_AUTODISCOVER_REPO_SORT`

<!-- prettier-ignore -->
Expand Down
15 changes: 15 additions & 0 deletions lib/config/options/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1224,6 +1224,21 @@ const options: RenovateOptions[] = [
cli: false,
env: false,
},
{
name: 'matchConfidence',
description:
'Merge confidence levels to match against (`low`, `neutral`, `high`, `very high`). Valid only within `packageRules` object.',
type: 'array',
subType: 'string',
allowedValues: ['low', 'neutral', 'high', 'very high'],
allowString: true,
stage: 'package',
parent: 'packageRules',
mergeable: true,
rarkins marked this conversation as resolved.
Show resolved Hide resolved
cli: false,
env: false,
experimental: true,
},
{
name: 'matchUpdateTypes',
description:
Expand Down
3 changes: 3 additions & 0 deletions lib/config/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import type { LogLevel } from 'bunyan';
import type { PlatformId } from '../constants';
import type { HostRule } from '../types';
import type { GitNoVerifyOption } from '../util/git/types';
import type { MergeConfidence } from '../util/merge-confidence';
rarkins marked this conversation as resolved.
Show resolved Hide resolved

export type RenovateConfigStage =
| 'global'
Expand Down Expand Up @@ -328,6 +329,7 @@ export interface PackageRule
matchSourceUrlPrefixes?: string[];
matchSourceUrls?: string[];
matchUpdateTypes?: UpdateType[];
matchConfidence?: MergeConfidence[];
registryUrls?: string[] | null;
}

Expand Down Expand Up @@ -458,6 +460,7 @@ export interface PackageRuleInputConfig extends Record<string, unknown> {
currentVersion?: string;
lockedVersion?: string;
updateType?: UpdateType;
mergeConfidenceLevel?: MergeConfidence;
isBump?: boolean;
sourceUrl?: string | null;
language?: string;
Expand Down
1 change: 1 addition & 0 deletions lib/config/validation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,7 @@ export async function validateConfig(
'matchSourceUrlPrefixes',
'matchSourceUrls',
'matchUpdateTypes',
'matchConfidence',
];
if (key === 'packageRules') {
for (const [subIndex, packageRule] of val.entries()) {
Expand Down
2 changes: 2 additions & 0 deletions lib/modules/manager/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import type {
import type { ProgrammingLanguage } from '../../constants';
import type { ModuleApi, RangeStrategy, SkipReason } from '../../types';
import type { FileChange } from '../../util/git/types';
import type { MergeConfidence } from '../../util/merge-confidence';

export type Result<T> = T | Promise<T>;

Expand Down Expand Up @@ -94,6 +95,7 @@ export interface LookupUpdate {
pendingVersions?: string[];
newVersion?: string;
updateType?: UpdateType;
mergeConfidenceLevel?: MergeConfidence;
rarkins marked this conversation as resolved.
Show resolved Hide resolved
userStrings?: Record<string, string>;
checksumUrl?: string;
downloadUrl?: string;
Expand Down
Loading