generated from actions/typescript-action
-
Notifications
You must be signed in to change notification settings - Fork 1
47 lines (41 loc) · 1.43 KB
/
abusive-comment-demo.yaml
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
44
45
46
47
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:
- uses: actions/checkout@v2
- name: Handle with Comvent
uses: ./
id: comvent
with:
token: ${{ secrets.GITHUB_TOKEN }}
config-path: .github/comvent-abusive-content-demo.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.some-abusive-content != ''
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 abusive comment! 😰
The comment was thus removed.`;
github.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: comment
})