From d735eae8f301819e5efb3369eb8bf976476ca8a2 Mon Sep 17 00:00:00 2001 From: Jigar Wala Date: Mon, 11 Sep 2023 21:01:28 +0530 Subject: [PATCH] raise warning when using params that are invalid with non automate projects --- packages/config/src/validate.js | 11 +++++++++++ 1 file changed, 11 insertions(+) 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: {