Fix buggy key check. #35
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: Auto-fix formatting of source code | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
fix_formatting: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.11 | |
- name: Install packages | |
run: | | |
python -m pip install --upgrade pip | |
pip install --user ruff==0.6.9 | |
- name: Auto-fix Python formatting | |
run: | | |
ruff format | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 18.x | |
cache: "npm" | |
- name: Install Prettier | |
run: npm ci | |
- name: Auto-fix code formatting (Prettier) | |
run: npx prettier --write . | |
- name: Commit changes | |
id: commit | |
run: | | |
git config --local user.name "GitHub Actions" | |
git config --local user.email "[email protected]" | |
git add . | |
if git diff --cached --quiet; then | |
echo "No formatting changes to commit." | |
else | |
git commit -m "✨ Auto-fix formatting" | |
echo "formatted=true" >> $GITHUB_OUTPUT | |
fi | |
- name: Push changes | |
if: ${{ steps.commit.outputs.formatted == 'true' }} | |
run: git push origin HEAD |