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    runs-on: ubuntu-latest
13    steps:
14      - name: Check for specific strings in comment
15        id: check_comment
16        uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7
17        with:
18          script: |
19            const comment = context.payload.comment.body;
20            const triggerStrings = ['www.mediafire.com'];
21            return triggerStrings.some(triggerString => comment.includes(triggerString));
22
23      - name: Delete comment if it contains any of the specific strings
24        if: steps.check_comment.outputs.result == 'true'
25        uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7
26        with:
27          script: |
28            const commentId = context.payload.comment.id;
29            await github.rest.issues.deleteComment({
30              owner: context.repo.owner,
31              repo: context.repo.repo,
32              comment_id: commentId
33            });