community_delete_comments.yml

 1name: Delete Mediafire Comments
 2
 3on:
 4  issue_comment:
 5    types: [created]
 6
 7permissions:
 8  issues: write
 9
10jobs:
11  delete_comment:
12    if: github.repository_owner == 'zed-industries'
13    runs-on: ubuntu-latest
14    steps:
15      - name: Check for specific strings in comment
16        id: check_comment
17        uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7
18        with:
19          script: |
20            const comment = context.payload.comment.body;
21            const triggerStrings = ['www.mediafire.com'];
22            return triggerStrings.some(triggerString => comment.includes(triggerString));
23
24      - name: Delete comment if it contains any of the specific strings
25        if: steps.check_comment.outputs.result == 'true'
26        uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7
27        with:
28          script: |
29            const commentId = context.payload.comment.id;
30            await github.rest.issues.deleteComment({
31              owner: context.repo.owner,
32              repo: context.repo.repo,
33              comment_id: commentId
34            });