-
-
Notifications
You must be signed in to change notification settings - Fork 406
43 lines (40 loc) · 1.39 KB
/
monitor-abusive.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
name: Monitor Abusive Comments
on:
issue_comment:
# This shouldn't be called for comment deletion
types:
- created
- edited
jobs:
abuse-monitor:
name: With latest code base
runs-on: ubuntu-latest
steps:
- name: Handle with Comvent
uses: rytswd/[email protected]
id: comvent
with:
token: ${{ secrets.GITHUB_TOKEN }}
config-path: .github/config/comvent-ad.yaml
# The below only runs when comvent finds matching comment.
# This assumes that comvent config holding 'some-abusive-content' as a keyword.
- if: steps.comvent.outputs.blocked-words != ''
name: Handle some abusive content
uses: actions/github-script@v3
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
# An example of removing the abusive comment, and leaving a comment about the deletion.
script: |
github.issues.deleteComment({
owner: context.repo.owner,
repo: context.repo.repo,
comment_id: ${{ github.event.comment.id }}
})
const comment = `Found blocked words! 😰
The comment was thus removed.`;
github.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: comment
})