Updated comment #51
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-format with Black | |
on: [push, pull_request_target ] | |
jobs: | |
auto-format: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
pull-requests: write | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
repository: HydroAnalyser/hydro-analyzer | |
token: ${{ secrets.TOKEN }} | |
ref: ${{ github.ref }} | |
- name: Install Black | |
run: pip install black | |
- name: Auto-format with Black | |
run: black . | |
- name: Commit changes | |
run: | | |
if [[ -n $(git status -s) ]]; then | |
git config --global user.name 'GitHub Actions' | |
git config --global user.email '[email protected]' | |
git add . | |
git commit -m "Auto-format with Black" | |
git push | |
else | |
echo "No changes to commit" | |
fi |