update #10
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: format code with ruff | |
on: | |
push: | |
branches: [dev] | |
jobs: | |
code-format: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
- name: Install ruff | |
run: pip install ruff | |
- name: Run ruff to format code | |
run: | | |
ruff check . --exit-zero | |
ruff format . | |
git add -u | |
- name: Commit and push changes | |
run: | | |
git config --global user.name "5hojib" | |
git config --global user.email "yesiamshojib@gmail.com" | |
if git diff-index --quiet HEAD --; then | |
echo "No changes to commit." | |
else | |
git commit -m "Auto-format code [skip actions]" | |
git push origin ${{ github.ref }} | |
fi | |
env: | |
GITHUB_TOKEN: ${{ secrets.GX_TOKEN }} |