Skip to content

Commit

Permalink
fix: add whitelisted user
Browse files Browse the repository at this point in the history
these user will auto pass route test
  • Loading branch information
NeverBehave authored Jan 25, 2021
1 parent 49d931b commit 6f90960
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion scripts/workflow/test-route/identify.js
Original file line number Diff line number Diff line change
@@ -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}`);
Expand All @@ -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
Expand Down

0 comments on commit 6f90960

Please sign in to comment.