name: lint

on:
  pull_request:
    branches:
      - master

jobs:
  lint:
    runs-on: [ubuntu-latest]
    steps:
    - name: Checkout sources
      uses: actions/checkout@v2
    - name: Setup luacheck
      run: |
        sudo apt update &&
        sudo apt install -y lua5.1 luarocks &&
        sudo luarocks install luacheck
    - name: Run luacheck
      run: |
        sudo make lint
  style-lint:
    runs-on: [ubuntu-latest]
    steps: 
    - name: Checkout sources
      uses: actions/checkout@v2
    - name: Lint with stylua
      uses: JohnnyMorganz/stylua-action@1.0.0
      with:
        token: ${{ secrets.GITHUB_TOKEN }}
        # CLI arguments
        args: --check .
