Skip to content

thomasbnt/NoToxicDiscussions

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

11 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

😢 Disclaimer : Read this before using it

For the moment, this GitHub Action doesn't work as properly as I would like. When GitHub adds the possibility to add and/or edit comments in Discussions, I will update the project.

I started this Action because I thought that it is a good idea to have a moderation tool in the Discussions part with the toxicity of comments. So I did it thinking it would be feasible, but when I got to the end of the code part, I couldn't figure out how to create/edit comments.


No Toxic Discussions

A GitHub action that detects toxic messages in Discussions.

No Toxic Discussions uses the Perspective API by Jigsaw from Google.

Follow me on Twitter Follow me on DEV

Workflow

Create the .github/workflows/NoToxicDiscussions.yml file with the following configuration :

name: No Toxic Discussions Here
on:
  discussion:
    # created type can be marked as an error BUT IT WORKS. See the docs :
    # https://docs.github.com/en/actions/learn-github-actions/events-that-trigger-workflows#discussion
    types: [ created, opened, edited, answered ]
  discussion_comment:
    types: [ created, edited ]
jobs:
  CheckIfToxicContent:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout Repository
        uses: actions/checkout@v2
        with:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          PERSPECTIVE_API_KEY: ${{ secrets.PERSPECTIVE_API_KEY }}
      - name: Install dependencies
        run: |
          yarn install
          yarn add @actions/core @actions/github
      - name: Run the script
        run: |
          yarn run start

Inputs

PERSPECTIVE_API_TOKEN
Required β€” This Action use the Perspective API. β€” Get your key here ➑

How it works

When anyone creates a new comment in a discussion or creates a new discussion, the script will check if the comment is toxic. If the author edits their comment, the Action will run again.

Output workflow :

Output workflow

Test locally

You can test the test/SampleRequestPerspectiveAPI.js file.

  1. Clone this project
  2. Create a .env file and put your GOOGLE_API_TOKEN
  3. Write a bad comment at CONTENT (line 6)
  4. Run with yarn run test or npm run test !

Contribute

Anyone can contribute to this GitHub Action. Feel free to discuss it in the section provided for this purpose. πŸ‘‹πŸΌ Read the contribution Guidelines first. You can also contribute by sharing this repository. πŸ˜„

Languages Supported

This Action is only for the english language for the moment. Maybe updates in the future will add others languages. We are based on Perspective API with only TOXICITY attribute name to detect bad comments, see the available languages on the official website

Additional informations

Donate

Feel free to help me for the maintenance of this project !

GitHub Sponsors Support me on Buy Me a Coffee

About

No Toxic Discussions, a GitHub Action to detect toxicity in discussions area.

Topics

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Sponsor this project

  •  

Contributors