mirror of
https://gitee.com/milvus-io/milvus.git
synced 2025-12-07 01:28:27 +08:00
enhance: add GitHub Actions to delete spam issues comments (#35807)
/kind improvement Signed-off-by: zhuwenxing <wenxing.zhu@zilliz.com>
This commit is contained in:
parent
b0ac04d104
commit
e34b0c43a1
34
.github/workflows/delete_comments.yaml
vendored
Normal file
34
.github/workflows/delete_comments.yaml
vendored
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
# via https://github.com/zed-industries/zed/blob/main/.github/workflows/delete_comments.yml
|
||||||
|
name: Delete Mediafire Comments
|
||||||
|
|
||||||
|
on:
|
||||||
|
issue_comment:
|
||||||
|
types: [created]
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
issues: write
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
delete_comment:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Check for specific strings in comment
|
||||||
|
id: check_comment
|
||||||
|
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7
|
||||||
|
with:
|
||||||
|
script: |
|
||||||
|
const comment = context.payload.comment.body;
|
||||||
|
const triggerStrings = ['www.mediafire.com'];
|
||||||
|
return triggerStrings.some(triggerString => comment.includes(triggerString));
|
||||||
|
|
||||||
|
- name: Delete comment if it contains any of the specific strings
|
||||||
|
if: steps.check_comment.outputs.result == 'true'
|
||||||
|
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7
|
||||||
|
with:
|
||||||
|
script: |
|
||||||
|
const commentId = context.payload.comment.id;
|
||||||
|
await github.rest.issues.deleteComment({
|
||||||
|
owner: context.repo.owner,
|
||||||
|
repo: context.repo.repo,
|
||||||
|
comment_id: commentId
|
||||||
|
});
|
||||||
Loading…
x
Reference in New Issue
Block a user