Skip to content

Commit 9da123c

Browse files
authored
Merge pull request #206 from Preeti9764/auto-reply
added auto reply
2 parents de504fa + db3105e commit 9da123c

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Auto Reply to Assign Requests
2+
3+
on:
4+
issue_comment:
5+
types: [created]
6+
7+
jobs:
8+
auto-reply:
9+
runs-on: ubuntu-latest
10+
env:
11+
ASSIGN_KEYWORDS: |
12+
assign this to me
13+
please assign
14+
assign me
15+
can you assign
16+
assign to me
17+
can i be assigned
18+
may i be assigned
19+
could you assign
20+
ASSIGN_RESPONSE: |
21+
Please go ahead and create a PR when you are ready. We do not formally assign issues. Contributors are free to pick up any open issue based on their availability. You can open a PR or even a draft PR to let others know that you’re working on it.
22+
steps:
23+
- name: Check for assign request and comment
24+
uses: actions/github-script@v7
25+
with:
26+
script: |
27+
// Get keywords from env, split by newlines, and trim
28+
const assignKeywords = process.env.ASSIGN_KEYWORDS.split('\n').map(k => k.trim()).filter(Boolean);
29+
// Create regex patterns for each keyword (case-insensitive)
30+
const assignPatterns = assignKeywords.map(k => new RegExp(k, 'i'));
31+
const commentBody = context.payload.comment.body;
32+
if (assignPatterns.some(pattern => pattern.test(commentBody))) {
33+
const commenter = context.payload.comment.user.login;
34+
const response = `@${commenter} ${process.env.ASSIGN_RESPONSE}`;
35+
github.rest.issues.createComment({
36+
issue_number: context.payload.issue.number,
37+
owner: context.repo.owner,
38+
repo: context.repo.repo,
39+
body: response
40+
});
41+
}

0 commit comments

Comments
 (0)