# SPDX-FileCopyrightText: (c) TagStudio Contributors
# SPDX-License-Identifier: GPL-3.0-only
---
name: Pyright

on: [push, pull_request]

jobs:
  pyright:
    name: Run Pyright
    runs-on: ubuntu-latest
    steps:
      - name: Checkout repo
        uses: actions/checkout@v4

      - name: Setup Python
        uses: actions/setup-python@v5
        with:
          python-version: "3.12"
          cache: pip

      - name: Install Python dependencies
        run: |
          python -m pip install --upgrade uv
          uv pip install --system .[pyright,pytest]

      - name: Execute Pyright
        uses: jordemort/action-pyright@v1
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}
          reporter: ${{ github.event_name == 'pull_request' && 'github-pr-review' || 'github-check' }}
