Home

Awesome

NSFW detection action

Stand With Ukraine GitHub release (latest SemVer including pre-releases) unit-tests functional-tests security linting Maintainability Test Coverage Known Vulnerabilities

This action checks each modified and added file with the extensions that is defined in action configuration and failed in case of threshold of NSFW check is greater or equals to the threshold defined in action configuration. NSFW detection runs by chosen provider.

Contents

Providers

Cloudmersive

Identifier is cloudmersive. Sign up to Cloudmersive official website. Then go to API Keys page, create a new one and copy it.

DeepAI

Identifier is deepai. Sign up to DeepAI official website. Then go to Profile page and copy api-key that is located on the top of the page.

PicPurify

Identifier is picpurify. Sign up to PicPurify official website. Then go to API Keys page and copy API key that is located on the top of the page.

SightEngine

Identifier is sightengine. Sign up to SightEngine official website. Then go to Get Started page and copy API user and API secret from the examples provided. This provider requires to provide 2 API identifiers, so please put them into api_key parameter separated by comma. For example, your api_user is 123456 and api_secret is abcdef, so api_key should be 123456,abcdef.

Inputs

NameRequiredDescriptionDefaultPossible values
github_tokenYesGitHub token<String>
providerYesProvider identifier<String>
api_keyYesAPI key that should be used for chosen provider<String>
thresholdYesAction will be failed in case NSFW detection value will be greater or equal to this parameter<Float>
typeNoType of committed files separated by commamodified,added,renamedmodified,added,renamed
extensionsNoList of file extensions separated by commajpeg,jpg,png,gif,webp,tiff,bmpjpeg,jpg,png,gif,webp,tiff,bmp

Example usage

Workflow configuration

name: Test

on: push

jobs:
  nsfw-detection:
    name: Build
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@main
      - uses: fabasoad/nsfw-detection-action@main
        with:
          provider: deepai
          threshold: 0.9
          type: modified,added,renamed
          extensions: jpg,jpeg
          github_token: ${{ secrets.GITHUB_TOKEN }}
          api_key: ${{ secrets.DEEPAI_API_KEY }}

Result

Result