name: CI

on: [push, pull_request]

jobs:
  build-lint-test:
    runs-on: [ubuntu-latest]

    strategy:
      matrix:
        node-version: [10.x, 12.x, 14.x, 15.x]

    steps:
      - uses: actions/checkout@v2
      - name: Setup Node
        uses: actions/setup-node@v1
        with:
          node-version: ${{matrix.node-version}}
      - name: Install Dependencies
        run: npm install
        env:
          NODE_ENV: development
      - name: Lint-CI
        run: npm run lint-ci
      - name: Test-CI
        run: npm run test-ci

  automerge:
    needs: build-lint-test
    runs-on: ubuntu-latest
    steps:
      - uses: fastify/github-action-merge-dependabot@v1
        if: ${{ github.actor == 'dependabot[bot]' && github.event_name == 'pull_request' }}
        with:
          github-token: ${{secrets.github_token}}
