File tree Expand file tree Collapse file tree 1 file changed +45
-0
lines changed Expand file tree Collapse file tree 1 file changed +45
-0
lines changed Original file line number Diff line number Diff line change
1
+ name : Delete Comments
2
+
3
+ on :
4
+ issue_comment :
5
+ types : [created]
6
+
7
+ permissions :
8
+ issues : write
9
+
10
+ jobs :
11
+ delete_comment :
12
+ runs-on : ubuntu-latest
13
+ steps :
14
+ - name : Check for specific strings in comment
15
+ id : check_comment
16
+ uses : actions/github-script@v6
17
+ with :
18
+ script : |
19
+ const comment = context.payload.comment.body;
20
+ const triggerStrings = ['www.mediafire.com', 'Download'];
21
+ return triggerStrings.some(triggerString => comment.includes(triggerString));
22
+
23
+ - name : Delete comment if it contains any of the specific strings
24
+ if : steps.check_comment.outputs.result == 'true'
25
+ uses : actions/github-script@v6
26
+ with :
27
+ script : |
28
+ const commentId = context.payload.comment.id;
29
+ await github.issues.deleteComment({
30
+ owner: context.repo.owner,
31
+ repo: context.repo.repo,
32
+ comment_id: commentId
33
+ });
34
+
35
+ - name : Block user if comment contains any of the specific strings
36
+ if : steps.check_comment.outputs.result == 'true'
37
+ uses : actions/github-script@v6
38
+ with :
39
+ script : |
40
+ const userId = context.payload.comment.user.id;
41
+ await github.users.block({
42
+ owner: context.repo.owner,
43
+ repo: context.repo.repo,
44
+ user_id: userId
45
+ });
You can’t perform that action at this time.
0 commit comments