😶 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.😵 But why do I still participate in the Hackathon, knowing that my action is not entirely finished?
The idea of using the Perspective API came to me quite late. In 4-5 days I had to learn how to create my own GA (GitHub Actions) and how to execute JavaScript. How to use correctly the TOKEN of GitHub. I still have some small issues to fix on the source code, but I'm working on it, and like any project, there will be updates.So when I was almost at the end, I looked at the GitHub documentation to find out how to create a comment in the Discussions with Action section. Unfortunately, it's not possible, and I'm disgusted. Nevertheless, I leave the source code visible for everybody, because when GitHub will have added this option, the code will be updated and possible to use in your repositories.
If you want to know more about how it works, I redirect you to How it's work part.For the moment it scans well and emits a percentage based on 1 the TOXICITY of the content.
My Workflow
No Toxic Discussions
thomasbnt / NoToxicDiscussions
No Toxic Discussions, a GitHub Action to detect toxicity in discussions area.
Output workflow :
Submission Category: Maintainer Must-Haves
Yaml File or Link to Code
You can see this example of workflow at .github/workflows/NoToxicDiscussions.yml
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
Additional Resources / Info
This Action use Perspective API from Jigsaw Google.
Perspective is a free API that helps you host better conversations online. The API uses machine learning models to score the perceived impact a comment might have on a conversation. You can use this score to give feedback to commenters, help moderators more easily review comments, allow readers to more easily find interesting or productive comments, and more.
Top comments (5)
Thanks @nenyoko ! 👍
great idea!
Thanks I appreciate your comment !
Keep up the good work!
Thanks!