name: Build
on:
  push:
    branches:
      - main
    paths-ignore:
      - 'README.md'
      - 'CHANGELOG.md'
      - '.github/**'
      - 'example/**'
  pull_request:
    types: [opened, synchronize, reopened]
    paths-ignore:
      - 'README.md'
      - 'CHANGELOG.md'
      - '.github/**'
      - 'example/**'
jobs:
  sonarcloud:
    name: SonarCloud
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
        with:
          fetch-depth: 0
      - name: Install dependencies
        run: npm install
      - name: Test and coverage
        run: npm run test -- --coverage
      - name: SonarCloud Scan
        uses: SonarSource/sonarcloud-github-action@master
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          SONAR_TOKEN: ${{ secrets. SONARCLOUD_TOKEN }}
