name: tests

on: [push, pull_request]

env:
  FORCE_COLOR: 1

jobs:
  test:
    runs-on: ${{ matrix.os }}

    strategy:
      matrix:
        os: [ubuntu-latest]
        node: [lts/*]

    steps:
    - uses: actions/checkout@v6
    - name: Use Node.js ${{ matrix.node }}
      uses: actions/setup-node@v6
      with:
        node-version: ${{ matrix.node }}
    - run: npm i
    - run: npm test

  automerge:
    needs: test
    runs-on: ubuntu-latest
    permissions:
      pull-requests: write
      contents: write
    steps:
      - uses: fastify/github-action-merge-dependabot@v3
        if: ${{ github.actor == 'dependabot[bot]' && github.event_name == 'pull_request' && contains(github.head_ref, 'dependabot/github_actions') }}
        with:
          github-token: ${{secrets.github_token}}
