mirror of
https://github.com/renovatebot/renovate.git
synced 2025-01-12 06:56:24 +00:00
fix: resolve repoConfig.extends with repo config (#7541)
This commit is contained in:
parent
8753386066
commit
ac7d8ea112
2 changed files with 11 additions and 4 deletions
|
@ -121,6 +121,7 @@ describe('workers/repository/init/config', () => {
|
|||
warnings: [],
|
||||
errors: [],
|
||||
});
|
||||
config.extends = [':automergeDisabled'];
|
||||
expect(await mergeRenovateConfig(config)).not.toBeUndefined();
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import path from 'path';
|
||||
import is from '@sindresorhus/is';
|
||||
import jsonValidator from 'json-dup-key-validator';
|
||||
import JSON5 from 'json5';
|
||||
|
||||
|
@ -149,11 +150,16 @@ export async function mergeRenovateConfig(
|
|||
): Promise<RenovateConfig> {
|
||||
let returnConfig = { ...config };
|
||||
const repoConfig = await detectRepoFileConfig();
|
||||
const configFileParsed = repoConfig?.configFileParsed || {};
|
||||
if (is.nonEmptyArray(returnConfig.extends)) {
|
||||
configFileParsed.extends = [
|
||||
...returnConfig.extends,
|
||||
...(configFileParsed.extends || []),
|
||||
];
|
||||
delete returnConfig.extends;
|
||||
}
|
||||
checkForRepoConfigError(repoConfig);
|
||||
const migratedConfig = await migrateAndValidate(
|
||||
config,
|
||||
repoConfig?.configFileParsed || {}
|
||||
);
|
||||
const migratedConfig = await migrateAndValidate(config, configFileParsed);
|
||||
if (migratedConfig.errors.length) {
|
||||
const error = new Error(CONFIG_VALIDATION);
|
||||
error.configFile = repoConfig.configFileName;
|
||||
|
|
Loading…
Reference in a new issue