44 lines
1.1 KiB
YAML
44 lines
1.1 KiB
YAML
# Python Lint
|
|
# Runs ruff check via uvx (no pip install needed)
|
|
# Bootstraps uv if not already available on the runner
|
|
#
|
|
# Usage:
|
|
# - uses: cal/gitea-actions/python-lint@main
|
|
# with:
|
|
# src: app/
|
|
|
|
name: Python Lint
|
|
description: Run ruff check on Python source code using uvx
|
|
|
|
inputs:
|
|
src:
|
|
description: Source directory or file to check
|
|
default: '.'
|
|
ruff-version:
|
|
description: Ruff version to use (e.g., 0.9.x)
|
|
default: ''
|
|
extra-args:
|
|
description: Additional arguments to pass to ruff check
|
|
default: ''
|
|
|
|
runs:
|
|
using: composite
|
|
steps:
|
|
- name: Ensure uv is available
|
|
shell: bash
|
|
run: |
|
|
if ! command -v uv &>/dev/null; then
|
|
echo "uv not found, installing..."
|
|
curl -LsSf https://astral.sh/uv/install.sh | sh
|
|
echo "$HOME/.local/bin" >> $GITHUB_PATH
|
|
fi
|
|
|
|
- name: Run ruff check
|
|
shell: bash
|
|
run: |
|
|
RUFF_SPEC="ruff"
|
|
if [ -n "${{ inputs.ruff-version }}" ]; then
|
|
RUFF_SPEC="ruff@${{ inputs.ruff-version }}"
|
|
fi
|
|
uvx $RUFF_SPEC check ${{ inputs.extra-args }} ${{ inputs.src }}
|