name: 'Python Lint'

on:
  push:
    branches:
      - dev
      - "release*"
    tags:
      - '*'
  pull_request:

env:
    FBT_TOOLCHAIN_PATH: /runner/_work
    SET_GH_OUTPUT: 1

jobs:
  lint_python:
    runs-on: [self-hosted,FlipperZeroShell]
    steps:
      - name: 'Decontaminate previous build leftovers'
        run: |
          if [ -d .git ]; then
            git submodule status || git checkout "$(git rev-list --max-parents=0 HEAD | tail -n 1)"
          fi

      - name: 'Checkout code'
        uses: actions/checkout@v3
        with:
          fetch-depth: 0
          ref: ${{ github.event.pull_request.head.sha }}

      - name: 'Check code formatting'
        run: ./fbt lint_py
