feat: allow filtering by pr author

This commit is contained in:
2018-10-18 16:41:57 -07:00
parent 87f4a94734
commit 68cccb72a9
3 changed files with 5 additions and 1 deletions

View File

@@ -1,6 +1,7 @@
GITHUB_ACCESS_TOKEN=xxx
COMMENT_ACTOR=ci-comment-username
COMMENT_ACTOR=username
COMMENT_BODY_REGEXP=build failed
COMMENT_BODY_REGEXP_FLAGS=i
PULL_LABEL_FILTER=
PULL_AUTHOR_FILTER=
PULL_RETEST_BODY=retest

View File

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

View File

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