This repository was archived by the owner on Apr 8, 2025. It is now read-only.
Bump isort from 5.13.2 to 6.0.1 #399
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: Linting | |
on: [pull_request] | |
jobs: | |
precommit: | |
name: ${{ matrix.name }} | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- id: bandit | |
name: Check with bandit | |
- id: black | |
name: Check code style | |
- id: blacken-docs | |
name: Check code style in documentation | |
- id: check-ast | |
name: Check Python AST | |
- id: check-case-conflict | |
name: Check for case conflicts | |
- id: check-docstring-first | |
name: Check docstring is first | |
- id: check-executables-have-shebangs | |
name: Check that executables have shebangs | |
- id: check-json | |
name: Check JSON files | |
- id: check-merge-conflict | |
name: Check for merge conflicts | |
- id: check-symlinks | |
name: Check for broken symlinks | |
- id: check-toml | |
name: Check TOML files | |
- id: check-yaml | |
name: Check YAML files | |
- id: codespell | |
name: Check code for common misspellings | |
- id: debug-statements | |
name: Debug Statements and imports (Python) | |
- id: detect-private-key | |
name: Detect Private Keys | |
- id: end-of-file-fixer | |
name: Check End of Files | |
- id: fix-byte-order-marker | |
name: Check UTF-8 byte order marker | |
- id: flake8 | |
name: Enforcing style guide with flake8 | |
- id: isort | |
name: Check imports are sorted | |
- id: poetry | |
name: Check pyproject file | |
- id: pyupgrade | |
name: Check for upgradable syntax | |
- id: pytest | |
name: Test with pytest | |
- id: trailing-whitespace | |
name: Trim Trailing Whitespace | |
- id: vulture | |
name: Find unused code | |
steps: | |
- name: Check out code from GitHub | |
uses: actions/checkout@v4 | |
- name: Set up Python 3.10 | |
id: python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.10" | |
- name: Get pip cache dir | |
run: echo "PIP_CACHE_DIR=$(pip cache dir)" >> $GITHUB_ENV | |
- name: Restore cached Python PIP packages | |
uses: actions/cache@v4 | |
with: | |
path: ${{ env.PIP_CACHE_DIR }} | |
key: pip-${{ runner.os }}-v1-${{ steps.python.outputs.python-version }}-${{ hashFiles('poetry.lock') }} | |
restore-keys: | | |
pip-${{ runner.os }}-v1-${{ steps.python.outputs.python-version }}- | |
- name: 🏗 Install workflow dependencies | |
run: | | |
pip install poetry | |
poetry config virtualenvs.create true | |
poetry config virtualenvs.in-project true | |
- name: Restore cached Python virtual environment | |
id: cached-poetry-dependencies | |
uses: actions/cache@v4 | |
with: | |
path: .venv | |
key: >- | |
venv-${{ runner.os }}-v1-${{ steps.python.outputs.python-version }}-${{ hashFiles('poetry.lock') }} | |
venv-${{ runner.os }}-v1-${{ steps.python.outputs.python-version }}- | |
- name: Install Python dependencies | |
run: poetry install --no-interaction | |
- name: Run pre-commit for ${{ matrix.id }} | |
run: poetry run pre-commit run ${{ matrix.id }} --all-files | |
- name: Regenerate poetry.lock if needed | |
run: | | |
if git diff --quiet pyproject.toml; then | |
echo "No changes in pyproject.toml, skipping poetry.lock regeneration." | |
else | |
echo "pyproject.toml has changed, regenerating poetry.lock..." | |
poetry lock | |
if git diff --quiet poetry.lock; then | |
echo "No changes to poetry.lock." | |
else | |
echo "::warning:: poetry.lock needs updating!" | |
fi | |
fi | |
- name: Commit updated poetry.lock | |
if: success() | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
git config --global user.name "GitHub Actions" | |
git config --global user.email "github-actions@github.com" | |
if git diff --quiet poetry.lock; then | |
echo "No changes in poetry.lock, skipping commit." | |
exit 0 | |
fi | |
git add poetry.lock | |
git commit -m "CI: Regenerate poetry.lock" | |
git push origin HEAD:${GITHUB_REF##*/} || { | |
echo "::error:: Failed to push updated poetry.lock. You may need to push manually." | |
exit 1 | |
} | |