3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-05-23 09:35:02 +00:00

add config validations

This commit is contained in:
metal 2021-09-08 12:15:38 +00:00 committed by GitHub
parent 9d93a11405
commit 1767dbced6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -134,6 +134,16 @@ const configPreprocessor: ConfigPreprocessorFn<AutomodPluginType> = options => {
} }
if (rule["actions"]) { if (rule["actions"]) {
if (rule["actions"].change_roles && (rule["actions"].add_roles || rule["actions"].remove_roles)) {
throw new StrictValidationError([
`Can't use both 'change_roles' and 'add_roles'/'remove_roles' at rule '${rule.name}'`,
]);
}
if (rule["actions"].add_roles && rule["actions"].remove_roles) {
throw new StrictValidationError([
`Can't use both 'add_roles' and 'remove_roles' at rule '${rule.name}', use 'change_roles' instead`,
]);
}
for (const actionName in rule["actions"]) { for (const actionName in rule["actions"]) {
if (!availableActions[actionName]) { if (!availableActions[actionName]) {
throw new StrictValidationError([`Unknown action '${actionName}' in rule '${rule.name}'`]); throw new StrictValidationError([`Unknown action '${actionName}' in rule '${rule.name}'`]);