name: Jest Coverage Diff

on: pull_request

jobs:
  coverage-check:
    if: github.actor != 'dependabot[bot]'
    name: Code Coverage Diff Check
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v3
      - name: Use Node.js
        uses: actions/setup-node@v3
        with:
          node-version: '20.x'
          cache: yarn
      - name: Install dependencies
        run: yarn
      - name: Test Coverage
        id: testCoverage
        uses: anuraag016/Jest-Coverage-Diff@V1.4
        with:
          fullCoverageDiff: false
          runCommand: "yarn jest --coverage --collectCoverage=true --coverageDirectory='./' --coverageReporters='json-summary' --forceExit --detectOpenHandles"
          delta: 0.1
