mirror of
https://github.com/renovatebot/renovate.git
synced 2025-01-11 14:36:25 +00:00
feat: validate renovate config file (#3389)
Extend renovate-config-validator to validate `config.js` and `RENOVATE_CONFIG_FILE`. Also add the execute bit to `config-validator.js` Fixed #3388
This commit is contained in:
parent
3e788c783a
commit
6aef5d2bc0
1 changed files with 13 additions and 0 deletions
13
bin/config-validator.js
Normal file → Executable file
13
bin/config-validator.js
Normal file → Executable file
|
@ -3,6 +3,7 @@
|
|||
const fs = require('fs-extra');
|
||||
const { validateConfig } = require('../lib/config/validation');
|
||||
const { massageConfig } = require('../lib/config/massage');
|
||||
const { getConfig } = require('../lib/config/file');
|
||||
const { initLogger } = require('../lib/logger');
|
||||
const cache = require('../lib/workers/global/cache');
|
||||
const { configFileNames } = require('../lib/config/app-strings');
|
||||
|
@ -63,6 +64,18 @@ async function validate(desc, config, isPreset = false) {
|
|||
} catch (err) {
|
||||
// ignore
|
||||
}
|
||||
try {
|
||||
const fileConfig = getConfig(process.env);
|
||||
console.log(`Validating config.js`);
|
||||
try {
|
||||
await validate('config.js', fileConfig);
|
||||
} catch (err) {
|
||||
console.log(`config.js is not valid Renovate config`);
|
||||
returnVal = 1;
|
||||
}
|
||||
} catch (err) {
|
||||
// ignore
|
||||
}
|
||||
if (returnVal !== 0) {
|
||||
process.exit(returnVal);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue