fix: resolve repoConfig.extends with repo config (#7541)

This commit is contained in:
Rhys Arkins 2020-10-25 07:49:34 +01:00 committed by GitHub
parent 8753386066
commit ac7d8ea112
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 4 deletions

View file

@ -121,6 +121,7 @@ describe('workers/repository/init/config', () => {
warnings: [], warnings: [],
errors: [], errors: [],
}); });
config.extends = [':automergeDisabled'];
expect(await mergeRenovateConfig(config)).not.toBeUndefined(); expect(await mergeRenovateConfig(config)).not.toBeUndefined();
}); });
}); });

View file

@ -1,4 +1,5 @@
import path from 'path'; import path from 'path';
import is from '@sindresorhus/is';
import jsonValidator from 'json-dup-key-validator'; import jsonValidator from 'json-dup-key-validator';
import JSON5 from 'json5'; import JSON5 from 'json5';
@ -149,11 +150,16 @@ export async function mergeRenovateConfig(
): Promise<RenovateConfig> { ): Promise<RenovateConfig> {
let returnConfig = { ...config }; let returnConfig = { ...config };
const repoConfig = await detectRepoFileConfig(); const repoConfig = await detectRepoFileConfig();
const configFileParsed = repoConfig?.configFileParsed || {};
if (is.nonEmptyArray(returnConfig.extends)) {
configFileParsed.extends = [
...returnConfig.extends,
...(configFileParsed.extends || []),
];
delete returnConfig.extends;
}
checkForRepoConfigError(repoConfig); checkForRepoConfigError(repoConfig);
const migratedConfig = await migrateAndValidate( const migratedConfig = await migrateAndValidate(config, configFileParsed);
config,
repoConfig?.configFileParsed || {}
);
if (migratedConfig.errors.length) { if (migratedConfig.errors.length) {
const error = new Error(CONFIG_VALIDATION); const error = new Error(CONFIG_VALIDATION);
error.configFile = repoConfig.configFileName; error.configFile = repoConfig.configFileName;