Skip to content

Commit bcbf6a1

Browse files
authored
Annoying ad
1 parent fe42cca commit bcbf6a1

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

.github/workflows/monitor-abusive.yml

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

0 commit comments

Comments
 (0)