diff --git a/python-lint/action.yml b/python-lint/action.yml new file mode 100644 index 0000000..6e775d7 --- /dev/null +++ b/python-lint/action.yml @@ -0,0 +1,38 @@ +# Python Lint +# Runs ruff check via uvx (no pip install needed) +# Bootstraps uv if not already available on the runner + +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 }}