From 6f909604b5704e5e401677efaf1aba696d361e23 Mon Sep 17 00:00:00 2001 From: NeverBehave Date: Mon, 25 Jan 2021 08:17:12 -0500 Subject: [PATCH] fix: add whitelisted user these user will auto pass route test --- scripts/workflow/test-route/identify.js | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/scripts/workflow/test-route/identify.js b/scripts/workflow/test-route/identify.js index 1677d62c6..d89a62f60 100644 --- a/scripts/workflow/test-route/identify.js +++ b/scripts/workflow/test-route/identify.js @@ -1,4 +1,5 @@ const noFound = 'Auto: Route No Found'; +const whiteListedUser = ['dependabot-preview[bot]']; module.exports = async ({ github, context, core }, body, number) => { core.debug(`sender: ${context.payload.sender.login}`); @@ -18,12 +19,28 @@ module.exports = async ({ github, context, core }, body, number) => { .catch((e) => { core.warning(e); }); + + if (whiteListedUser.includes(context.payload.sender.login)) { + core.info('PR created by a whitelisted user, passing'); + await removeLabel(); + await github.issues + .addLabels({ + issue_number: number, + owner: context.repo.owner, + repo: context.repo.repo, + labels: ['Auto: whitelisted'], + }) + .catch((e) => { + core.warning(e); + }); + return; + } if (m && m[1]) { res = m[1].trim().split('\r\n'); core.info(`routes detected: ${res}`); - if ((res.length > 0 && res[0] === 'NOROUTE') || context.payload.sender.login === 'dependabot-preview[bot]') { + if ((res.length > 0 && res[0] === 'NOROUTE')) { core.info('PR stated no route, passing'); await removeLabel(); await github.issues