Giter Site home page Giter Site logo

franky47 / actions-notoxicdiscussions Goto Github PK

View Code? Open in Web Editor NEW

This project forked from thomasbnt/notoxicdiscussions

0.0 1.0 0.0 8.59 MB

A GitHub action that detects toxic messages in Discussions.

License: GNU General Public License v3.0

JavaScript 100.00%

actions-notoxicdiscussions's Introduction

๐Ÿ˜ถ Disclaimer : Read that before use it

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

I started this Action because I thinked that it is a good idea to have a moderate tool in 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 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'S WORK. 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 Perspective API. โ€” Get your key here โžก

How it's work

When anyone create a new comment in a discussion or create a new discussion, the script will check if the comment is toxic. If the author edit this comment, the Actions run again.

Output workflow :

Output workflow

Test locally

You can test the test/SampleRequestPerspectiveAPI.js file.

  1. Clone this project
  2. Create an .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 to share this repository. ๐Ÿ˜„

Languages Supported

This Action is only for english language for the moment. Maybe updates in the future 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

actions-notoxicdiscussions's People

Contributors

thomasbnt avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.