feat: New Configuration option fetchReleaseNotes (#7404)

This commit is contained in:
Jean-Michel Leclercq 2020-10-19 10:05:05 +02:00 committed by GitHub
parent 082f1ba03f
commit bb9e30f64a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 51 additions and 1 deletions

View file

@ -436,6 +436,10 @@ The above will change a raw version of `release-2.0.0` to `2.0.0`, for example.
}
```
## fetchReleaseNotes
Configure this to `false` if you want to disable release notes fetching
## fileMatch
`fileMatch` is used by Renovate to know which files in a repository to parse and extract, and it is possible to override defaults values to customize for your project's needs.

View file

@ -176,6 +176,8 @@ export interface RenovateConfig
warnings?: ValidationMessage[];
vulnerabilityAlerts?: RenovateSharedConfig;
regexManagers?: CustomManager[];
fetchReleaseNotes?: boolean;
}
export interface AssigneesAndReviewersConfig {

View file

@ -1836,6 +1836,14 @@ const options: RenovateOptions[] = [
cli: false,
env: false,
},
{
name: 'fetchReleaseNotes',
description: 'Allow to disable release notes fetching',
type: 'boolean',
default: true,
cli: false,
env: false,
},
];
export function getOptions(): RenovateOptions[] {

View file

@ -1,10 +1,14 @@
import { RenovateConfig, mocked } from '../../../../test/util';
import { getConfig } from '../../../config/defaults';
import * as _changelog from '../changelog';
import { branchifyUpgrades } from './branchify';
import * as _flatten from './flatten';
const flattenUpdates = mocked(_flatten).flattenUpdates;
const embedChangelogs = mocked(_changelog).embedChangelogs;
jest.mock('./flatten');
jest.mock('../changelog');
let config: RenovateConfig;
beforeEach(() => {
@ -113,5 +117,35 @@ describe('workers/repository/updates/branchify', () => {
const res = await branchifyUpgrades(config, {});
expect(Object.keys(res.branches)).toHaveLength(2);
});
it('no fetch changelogs', async () => {
config.fetchReleaseNotes = false;
flattenUpdates.mockResolvedValueOnce([
{
depName: 'foo',
branchName: 'foo',
prTitle: 'some-title',
version: '1.1.0',
groupName: 'My Group',
group: { branchName: 'renovate/{{groupSlug}}' },
},
{
depName: 'foo',
branchName: 'foo',
prTitle: 'some-title',
version: '2.0.0',
},
{
depName: 'bar',
branchName: 'bar-{{version}}',
prTitle: 'some-title',
version: '1.1.0',
groupName: 'My Group',
group: { branchName: 'renovate/my-group' },
},
]);
const res = await branchifyUpgrades(config, {});
expect(embedChangelogs).not.toHaveBeenCalled();
expect(Object.keys(res.branches)).toHaveLength(2);
});
});
});

View file

@ -37,7 +37,9 @@ export async function branchifyUpgrades(
);
}
logger.debug(`Returning ${Object.keys(branchUpgrades).length} branch(es)`);
if (config.fetchReleaseNotes) {
await embedChangelogs(branchUpgrades);
}
for (const branchName of Object.keys(branchUpgrades)) {
// Add branch name to metadata before generating branch config
addMeta({