name: "Lints Python code"

on:
  push:
    paths:
      - "**.py"
      - ".flake8"
  pull_request:
    paths:
      - "**.py"
      - ".flake8"

jobs:
  python-linting:
    name: "Lints Python code"
    runs-on: ubuntu-latest

    steps:
      - name: Checkout
        uses: actions/checkout@v2

      - name: Install Taskfile
        uses: Arduino/actions/setup-taskfile@master
        with:
          repo-token: ${{ secrets.GITHUB_TOKEN }}
          version: 3.x

      - name: Activate Python
        uses: actions/setup-python@v1
        with:
          python-version: "3.8"
          architecture: "x64"

      - name: Install Poetry
        run: pip install poetry

      - name: Lints Python files
        run: task python:check
