fix: add whitelisted user

these user will auto pass route test
This commit is contained in:
NeverBehave 2021-01-25 08:17:12 -05:00 committed by GitHub
parent 49d931b7c9
commit 6f909604b5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 18 additions and 1 deletions

View File

@ -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