Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions .github/workflows/syntax-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Python Syntax Check

on:
push:
branches: ['**']
pull_request:
branches: ['**']

jobs:
syntax-check:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'

- name: Install uv
uses: astral-sh/setup-uv@v4

- name: Install ruff
run: uv tool install ruff

- name: Get changed Python files
id: changed-files
uses: tj-actions/changed-files@v45
with:
files: |
**/*.py

- name: Run ruff format check
if: steps.changed-files.outputs.any_changed == 'true'
run: |
echo "Changed files: ${{ steps.changed-files.outputs.all_changed_files }}"
uv tool run ruff format --check ${{ steps.changed-files.outputs.all_changed_files }}

- name: Run ruff check
if: steps.changed-files.outputs.any_changed == 'true'
run: |
uv tool run ruff check ${{ steps.changed-files.outputs.all_changed_files }}
2 changes: 1 addition & 1 deletion src/talk_python_cli/formatting.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def display_json(content: str) -> None:
"""Output JSON content — pretty-printed if on a TTY, raw otherwise."""
try:
data = json.loads(content)
except json.JSONDecodeError, TypeError:
except (json.JSONDecodeError, TypeError):
# Server may have returned Markdown even though JSON was requested;
# fall back to printing the raw text.
console.print(content)
Expand Down