name: Pull Request Checks

on: [pull_request]

jobs:
  build_image:
    name: Build Image
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2

      - name: Make GITHUB_ACCESS_TOKEN available
        run: echo $GITHUB_ACCESS_TOKEN > GITHUB_ACCESS_TOKEN
        env:
          GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_ACCESS_TOKEN }}

      - name: Docker Build
        run: DOCKER_BUILDKIT=1 docker build . -t docker.pkg.github.com/josephduffy/josephduffy.co.uk/website:$GITHUB_SHA --secret=id=GITHUB_ACCESS_TOKEN,src=./GITHUB_ACCESS_TOKEN

  check_format:
    name: Check for formatting errors using on ${{ matrix.os }}
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        os: [ubuntu-latest]

    steps:
      - uses: actions/checkout@v2

      - name: Install node version from .node-version
        shell: bash -l {0}
        run: nvm use < .node-version

      - run: npm install
      - run: npm run format:check

  lint:
    name: Check for linting errors using on ${{ matrix.os }}
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        os: [ubuntu-latest]

    steps:
      - uses: actions/checkout@v2

      - uses: hallee/eslint-action@v1
        with:
          repo-token: ${{secrets.GITHUB_TOKEN}}

name: Pull Request Checks

on: [pull_request]

jobs:
  build_image:
    name: Build Image
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2

      - name: Make GITHUB_ACCESS_TOKEN available
        run: echo $GITHUB_ACCESS_TOKEN > GITHUB_ACCESS_TOKEN
        env:
          GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_ACCESS_TOKEN }}

      - name: Docker Build
        run: DOCKER_BUILDKIT=1 docker build . -t docker.pkg.github.com/josephduffy/josephduffy.co.uk/website:$GITHUB_SHA --secret=id=GITHUB_ACCESS_TOKEN,src=./GITHUB_ACCESS_TOKEN

  check_format:
    name: Check for formatting errors using on ${{ matrix.os }}
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        os: [ubuntu-latest]

    steps:
      - uses: actions/checkout@v2

      - name: Install node version from .node-version
        shell: bash -l {0}
        run: |
          cp .node-version .nvmrc
          nvm use

      - run: npm install
      - run: npm run format:check

  lint:
    name: Check for linting errors using on ${{ matrix.os }}
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        os: [ubuntu-latest]

    steps:
      - uses: actions/checkout@v2

      - uses: hallee/eslint-action@v1
        with:
          repo-token: ${{secrets.GITHUB_TOKEN}}

Copy `.node-version` to `.nvmrc` before `nvm use`
Copy `.node-version` to `.nvmrc` before `nvm use`
