Skip to content

GitHub action moderating/deleting content based on repetitive occurrences in a message

License

Notifications You must be signed in to change notification settings

kerhub/spammy-guardian

Repository files navigation

Spammy guardian

spammy logo

GitHub Action deleting comments and closing issues based on repetitive occurrences in a comment.

Motivation

Being hit by fake spam accounts is a common problem for open-source projects. This GitHub Action is a simple way to prevent spammy comments. A target example with mass tags is the following:

Check my photos on **url**
@AZE @AZE @AZE @AZE @AZE @AZE @AZE @AZE

Inputs

Input Required Description Default
minOccurences false min count of occurrences to trigger the action 10
regex false Regex to test the occurrences against /@(\w+)/g
title false optional title replacement for closed issues '[Moderated]'
body false optional body replacement for closed issues 'Moderated content'

workflow_dispatch inputs

Input Required Description Default
issueId false to test the action against all comments from an issue (workflow-dispatch only)

Triggers

Name Description
issue_comment to test on comment creation
issues to test on issue creation
workflow_dispatch manual run on an issue (requires an issue id)

Workflow examples

on issue comment

name: Spammy Guardian
on: [issue_comment]
jobs:
  spammy-guardian:
    runs-on: ubuntu-latest
    steps:
      - uses: kerhub/[email protected]
        with:
          minOccurrences: 5
          regex: /@(\w+)/g

on issue creation

name: Spammy Guardian
on: 
  issues:
    types: [opened]
jobs:
  spammy-guardian:
    runs-on: ubuntu-latest
    steps:
      - uses: kerhub/[email protected]
        with:
          minOccurrences: 5
          regex: /@(\w+)/g  

on workflow_dispatch

name: Spammy Guardian
on: 
  workflow_dispatch:
    inputs:
      issueId:
        description: 'Issue ID'
        required: true
jobs:
  spammy-guardian:
    runs-on: ubuntu-latest
    steps:
      - uses: kerhub/[email protected]
        with:
          minOccurrences: 5
          regex: /@(\w+)/g  

Credits

Logo created by HJ Studio - Flaticon

About

GitHub action moderating/deleting content based on repetitive occurrences in a message

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Sponsor this project