name: Code Coverage (*nix)

on:
  workflow_call:

permissions:
  contents: read

jobs:
  check-coverage:
    runs-on: ubuntu-latest
    permissions:
      contents: read
    steps:
      - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
        with:
          persist-credentials: false

      - uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
        with:
          node-version: 'lts/*'
          cache: 'npm'
          cache-dependency-path: package.json
          check-latest: true

      - name: Install
        run: |
          npm install --ignore-scripts

      # Here, we verify the coverage thresholds so that this workflow can pass
      # or fail and stop further workflows if this one fails.
      - name: Verify coverage meets thresholds
        run: |
          npm run coverage:ci-check-coverage