diff --git a/packages/config/src/validate.js b/packages/config/src/validate.js index 02e553811..2a58da0b0 100644 --- a/packages/config/src/validate.js +++ b/packages/config/src/validate.js @@ -19,6 +19,17 @@ const ajv = new AJV({ getDefaultSchema() ], keywords: [{ + keyword: 'onlyAutomate', + error: { + message: 'Only valid for Automate type projects' + }, + code: cxt => { + let isAutomateProjectToken = (process.env.PERCY_TOKEN || '').split('_')[0] === 'auto'; + if (!isAutomateProjectToken) { + cxt.error(); + } + } + }, { // custom instanceof schema validation keyword: 'instanceof', metaSchema: {