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