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: [],
|
warnings: [],
|
||||||
errors: [],
|
errors: [],
|
||||||
});
|
});
|
||||||
|
config.extends = [':automergeDisabled'];
|
||||||
expect(await mergeRenovateConfig(config)).not.toBeUndefined();
|
expect(await mergeRenovateConfig(config)).not.toBeUndefined();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -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;
|
||||||
|
|
Loading…
Reference in a new issue