mirror of
https://github.com/renovatebot/renovate.git
synced 2025-01-12 23:16:26 +00:00
eeefc3c8f3
This PR updates Renovate to detect config validation problems and (1) stop processing, and (2) either raise an Issue if already onboarded, or (2) update the onboarding PR to reflect the error if still onboarding. Closes #1300
33 lines
1.1 KiB
JavaScript
33 lines
1.1 KiB
JavaScript
const configMigration = require('./migration');
|
|
const configMassage = require('./massage');
|
|
const configValidation = require('./validation');
|
|
|
|
module.exports = {
|
|
migrateAndValidate,
|
|
};
|
|
|
|
function migrateAndValidate(config, input) {
|
|
logger.debug('migrateAndValidate()');
|
|
const { isMigrated, migratedConfig } = configMigration.migrateConfig(input);
|
|
if (isMigrated) {
|
|
logger.info(
|
|
{ oldConfig: input, newConfig: migratedConfig },
|
|
'Config migration necessary'
|
|
);
|
|
}
|
|
const massagedConfig = configMassage.massageConfig(migratedConfig);
|
|
const { warnings, errors } = configValidation.validateConfig(massagedConfig);
|
|
// istanbul ignore if
|
|
if (warnings.length) {
|
|
logger.info({ warnings }, 'Found renovate config warnings');
|
|
}
|
|
if (errors.length) {
|
|
logger.info({ errors }, 'Found renovate config errors');
|
|
}
|
|
massagedConfig.errors = (config.errors || []).concat(errors);
|
|
if (!config.repoIsOnboarded) {
|
|
// TODO #556 - enable warnings in real PRs
|
|
massagedConfig.warnings = (config.warnings || []).concat(warnings);
|
|
}
|
|
return massagedConfig;
|
|
}
|