ci: lint the full repository

With the tree clean, the lint job runs ruff check . on every push and PR rather
than only the files a PR changes, so a lint regression is caught anywhere.
This commit is contained in:
Yijia-Xiao
2026-06-14 16:38:36 +00:00
parent e3bc872982
commit 6b6177ebf7

View File

@@ -46,30 +46,16 @@ jobs:
python -c "import tradingagents, cli.main; print('clean-install import OK')" python -c "import tradingagents, cli.main; print('clean-install import OK')"
lint: lint:
name: ruff (changed files, strict) name: ruff (strict, full repo)
runs-on: ubuntu-latest runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v5 - uses: actions/setup-python@v5
with: with:
python-version: "3.12" python-version: "3.12"
- name: Install ruff - name: Install ruff
run: pip install "ruff>=0.15" run: pip install "ruff>=0.15"
- name: Lint only the Python files this PR changes - name: Lint the repository
env: # The repo is fully clean under the strict select, so we lint everything
BASE_SHA: ${{ github.event.pull_request.base.sha }} # (results/ and worklog/ are excluded via pyproject extend-exclude).
run: | run: ruff check .
# Strict going-forward gate: the full-repo cleanup is deferred (see
# worklog 03/01), so we lint only files this PR adds or modifies.
files=$(git diff --name-only --diff-filter=ACM "$BASE_SHA"...HEAD -- '*.py' \
| grep -vE '^(results|worklog)/' || true)
if [ -z "$files" ]; then
echo "No Python changes to lint."
exit 0
fi
echo "Linting changed files:"
echo "$files"
ruff check $files