feat: allow filtering by pr author
This commit is contained in:
@@ -18,6 +18,7 @@ export default async function() {
|
||||
COMMENT_BODY_REGEXP_FLAGS,
|
||||
COMMENT_ACTOR,
|
||||
PULL_LABEL_FILTER,
|
||||
PULL_AUTHOR_FILTER,
|
||||
PULL_RETEST_BODY,
|
||||
} = process.env;
|
||||
|
||||
@@ -36,6 +37,7 @@ export default async function() {
|
||||
const pull = await getPull(repo, comment.number);
|
||||
|
||||
if (pull.state !== 'open') return false; // filter out any closed pulls
|
||||
if (PULL_AUTHOR_FILTER && !pull.owner !== PULL_AUTHOR_FILTER) return false; // filter on owner
|
||||
if (PULL_LABEL_FILTER && !pull.labels.includes(PULL_LABEL_FILTER)) return false; // filter on label
|
||||
|
||||
return { comment, pull };
|
||||
|
||||
@@ -4,6 +4,7 @@ export default async function getPull(repo, id) {
|
||||
id: pull.id,
|
||||
url: pull.url,
|
||||
number: pull.number,
|
||||
owner: pull.user.login,
|
||||
state: pull.state,
|
||||
title: pull.title,
|
||||
labels: pull.labels.map(label => label.name),
|
||||
|
||||
Reference in New Issue
Block a user