Skip to content

Commit 19e4855

Browse files
feat: add option to ignore workflow for specific users
1 parent 67cfc09 commit 19e4855

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed

action.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ inputs:
2525
description: 'To filter the issues that are assigned to the author'
2626
default: 'false'
2727
required: false
28+
ignore-users:
29+
description: 'Specify usernames that should be ignored while running this workflow'
30+
default: 'false'
31+
required: false
2832
runs:
2933
using: 'node16'
3034
main: 'dist/index.js'

dist/index.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,14 @@ async function HandleMultipleIssues() {
5353
const issueNumber = core.getInput("issueNumber") === "true";
5454
const comment = core.getInput("comment");
5555
const close = core.getInput("close") === "true" || false;
56+
const ignoreUsers = core.getInput("ignore-users").split(",").map(user => user.trim());
5657
const checkComment = comment.trim() !== "";
5758
// Check if the same author has open issues
5859
const author = (_a = context.payload.issue) === null || _a === void 0 ? void 0 : _a.user.login;
60+
if (ignoreUsers.includes(author)) {
61+
core.notice(`User: ${author} is on the ignore list. Ignoring the workflow for this user.`);
62+
return; // No need to continue.
63+
}
5964
core.notice("step 2.");
6065
const { data: authorIssues } = await octokit.rest.issues.listForRepo({
6166
owner: context.repo.owner,

src/index.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,18 @@ async function HandleMultipleIssues() {
2626
const issueNumber = core.getInput("issueNumber") === "true";
2727
const comment = core.getInput("comment");
2828
const close = core.getInput("close") === "true" || false;
29+
const ignoreUsers = core.getInput("ignore-users").split(",").map(user => user.trim());
2930

3031
const checkComment = comment.trim() !== "";
3132

3233
// Check if the same author has open issues
3334
const author = context.payload.issue?.user.login;
3435

36+
if (ignoreUsers.includes(author)) {
37+
core.notice(`User: ${author} is on the ignore list. Ignoring the workflow for this user.`);
38+
return; // No need to continue.
39+
}
40+
3541
core.notice("step 2.");
3642

3743
const { data: authorIssues } = await octokit.rest.issues.listForRepo({

0 commit comments

Comments
 (0)