Skip to content
You're viewing an older version of this GitHub Action. Do you want to see the latest version instead?
filter

GitHub Action

Potty mouth

1.0.8

Potty mouth

filter

Potty mouth

A GitHub Action profanity filter, used on issues and pull requests to automatically filter out profane content

Installation

Copy and paste the following snippet into your .yml file.

              

- name: Potty mouth

uses: IEvangelist/profanity-filter@1.0.8

Learn more about this action in IEvangelist/profanity-filter

Choose a version

GitHub Action: 🤬 Profane content filter

.NET Dogfood

The GitHub Action: Profane content filter maintains over 4,970 swear words from nine different languages. For a list of all supported languages and swear words, see the data directory. This tool can be used to scan issues and pull requests for profanity. It can be configured to replace any profane content with either asterisks or emojis. This action can be useful for maintaining a professional and respectful environment in your GitHub repository.

⁉️ Why

But why is this important? Let's be honest, not everyone who creates issues or pull requests use appropriate language (it's not always rainbows and ponies, am I right?) With this action in your repositories GitHub workflow, it can be 🌈 and 🐎.

🤓 Usage

The following is an example of how to use the action as a standalone workflow:

# The name of the workflow
name: Profanity filter

# Trigger on issue or pull requests, that are opened, edited, or reopened
on:
  issues:
    types:
      - opened
      - edited
      - reopened
  pull_request:
    types:
      - opened
      - edited
      - reopened

jobs:
  # Name the job whatever you'd like
  filter:

    runs-on: ubuntu-latest
    permissions:
      # Required permissions.
      issues: write
      pull-requests: write

    steps:

    # Name the step anything that makes sense to you
    - name: Scan issue or pull request for profanity
      # Conditionally run the step if the actor isn't a bot
      if: ${{ github.actor != 'dependabot[bot]' && github.actor != 'github-actions[bot]' }}
      uses: IEvangelist/profanity-filter@main
      id: profanity-filter
      with:
        token: ${{ secrets.GITHUB_TOKEN }}
        replacement-type: Emoji # See Replacement types

If you already have an existing workflow that is triggered on/issues|pull_request/types/opened|edited|reopened feel free to simply add a step to the existing job:

- name: Scan issue or pull request for profanity
  if: ${{ github.actor != 'dependabot[bot]' && github.actor != 'github-actions[bot]' }}
  uses: IEvangelist/profanity-filter@main
  id: profanity-filter
  with:
    token: ${{ secrets.GITHUB_TOKEN }}
    replacement-type: Emoji # See Replacement types

👀 Inputs

This action has two inputs, token and replacement-type. Only the token is required, and the replacement-type defaults to Asterisk when not specified.

The following table describes each input:

Input Description Required
token The GitHub token used to update the issues or pull requests with. Example, secrets.GITHUB_TOKEN. true
replacement-type The type of replacement method to use when profane content is filtered. Valid values are, Asterisk or Emoji. false (default: Asterisk)

😵 Replacement types

Each replacement type corresponds to a different way of replacing profane content. The following represents the available replacement types:

ReplacementType Valid string value Description
ReplacementType.Asterisk "Asterisk" Replaces profane content with asterisks. For example, a swear word with four letters would look like this ****.
ReplacementType.Emoji "Emoji" Replaces profane content with a random swear emoji. For example, a swear word with four letters could look like this 💩.
ReplacementType.RandomAsterisk "RandomAsterisk" Replaces profane content with a random number of asterisks. For example, a swear word with four letters could look like any value between * and ****.
ReplacementType.MiddleAsterisk "MiddleAsterisk" Replaces profane content with asterisks, but only in the middle of the word. For example, a swear word with four letters could look like this f**k.
ReplacementType.MiddleSwearEmoji "MiddleSwearEmoji" Replaces profane content with a random swear emoji, but only in the middle of the word. For example, a swear word with four letters could look like this f🤬k.
ReplacementType.VowelAsterisk "VowelAsterisk" Replaces profane content with asterisks, but only the vowels. For example, a swear word with four letters could look like this sh*t.

🏷️ Label requirements

This action will look for a label with the following verbatim name "profane content 🤬", if found this label is applied to any issue or pull request where profane content filtration occurs.

🎬 What happens?

When profane content is detected, the action will update the issue or pull request by:

  • replacing any found profane content with the configured replacement type
  • reacting to the issue or pull request with the confused 😕 reaction
  • and conditionally applying the profane content 🤬 label if found in the repository.