bump action versions #18
This file contains 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: Lint and Format | |
on: [push, pull_request] | |
permissions: | |
contents: write | |
jobs: | |
lint-and-format: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.10' | |
- name: Install dependencies | |
run: | | |
pip install isort black ruff | |
- name: Run isort | |
run: | | |
isort . | |
- name: Run black | |
run: | | |
black . | |
- name: Run ruff | |
run: | | |
ruff check . --fix | |
- name: Commit and push changes if needed | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
git config --local user.name "github-actions[bot]" | |
git config --local user.email "github-actions[bot]@users.noreply.github.com" | |
if ! git diff --quiet; then | |
git add . | |
git commit -m "Format code with isort, black, and ruff [skip ci]" | |
git push | |
else | |
echo "No changes to commit." | |
fi |