fabasoad/nsfw-detection-action

View on GitHub
.github/workflows/functional-tests.yml

Summary

Maintainability
Test Coverage
---
name: Functional Tests

on: # yamllint disable-line rule:truthy
  pull_request: {}
  push:
    branches:
      - main

jobs:
  detect:
    name: ${{ matrix.provider }}
    timeout-minutes: 5
    runs-on: ubuntu-latest
    strategy:
      fail-fast: false
      matrix:
        include:
          - provider: cloudmersive
            api-key: CLOUDMERSIVE_API_KEY
            threshold: 0.32
          - provider: deepai
            api-key: DEEPAI_API_KEY
            threshold: 0.39
          - provider: picpurify
            api-key: PICPURIFY_API_KEY
            threshold: 0.97
          - provider: sightengine
            api-user: SIGHTENGINE_API_USER
            api-key: SIGHTENGINE_API_SECRET
            threshold: 0.8
    steps:
      - name: Checkout ${{ github.repository }}
        uses: actions/checkout@v4
      - name: Prepare API key
        id: secrets
        run: |
          if [ "${{ matrix.provider }}" = "sightengine" ]; then
            echo "api-key=${{ secrets[matrix.api-user] }},${{ secrets[matrix.api-key] }}" >> $GITHUB_OUTPUT
          else
            echo "api-key=${{ secrets[matrix.api-key] }}" >> $GITHUB_OUTPUT
          fi
      - name: Download test file
        run: |
          curl https://images-na.ssl-images-amazon.com/images/I/91cDPlxcRiL._SL1500_.jpg --output test.jpg
          git add test.jpg
      - name: Detect NSFW content
        uses: ./
        with:
          github_token: "${{ secrets.GITHUB_TOKEN }}"
          provider: "${{ matrix.provider }}"
          api_key: "${{ steps.secrets.outputs.api-key }}"
          threshold: "${{ matrix.threshold }}"