chore:enable unit test CI for v2 changes #7536
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Check sorting of imports | |
| on: | |
| pull_request: | |
| paths: | |
| - '**.py' | |
| - 'pyproject.toml' | |
| jobs: | |
| isort-check: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 2 | |
| - name: Set up Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: '3.11' | |
| - name: Install isort | |
| run: | | |
| pip install isort | |
| - name: Run isort on changed files | |
| id: run_isort | |
| run: | | |
| git fetch origin ${GITHUB_BASE_REF} | |
| CHANGED_FILES=$(git diff --diff-filter=ACMR --name-only origin/${GITHUB_BASE_REF}...HEAD | grep -E '\.py$' || true) | |
| if [ -n "$CHANGED_FILES" ]; then | |
| echo "Changed Python files:" | |
| echo "$CHANGED_FILES" | |
| echo "" | |
| FORMATTED_FILES=$(echo "$CHANGED_FILES" | tr '\n' ' ') | |
| # Run isort --check | |
| set +e | |
| isort --check $CHANGED_FILES | |
| RESULT=$? | |
| set -e | |
| if [ $RESULT -ne 0 ]; then | |
| echo "" | |
| echo "❌ isort check failed!" | |
| echo "👉 To fix import order, run locally:" | |
| echo "" | |
| echo " isort $FORMATTED_FILES" | |
| echo "" | |
| exit $RESULT | |
| fi | |
| else | |
| echo "No Python files changed. Skipping isort check." | |
| fi |