updated taxi configs #58
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: Autoformat with Black and Create PR | |
| on: | |
| push: | |
| branches: [main] | |
| # pull_request: | |
| # branches: [main] | |
| jobs: | |
| format: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| with: | |
| token: ${{ secrets.PERSONAL_ACCESS_TOKEN }} # Use the PAT for checkout | |
| fetch-depth: 0 | |
| # Persist credentials for pushing changes | |
| persist-credentials: true | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.x' | |
| - name: Install Black | |
| run: pip install black | |
| - name: Format code with Black and check for changes | |
| id: black_format | |
| run: | | |
| black --verbose . | |
| if git diff --quiet; then | |
| echo "::set-output name=changes_made::false" | |
| else | |
| echo "::set-output name=changes_made::true" | |
| fi | |
| - name: Commit and push changes if there were any | |
| if: steps.black_format.outputs.changes_made == 'true' | |
| run: | | |
| git config --global user.name 'github-actions' | |
| git config --global user.email '[email protected]' | |
| git add . | |
| git commit -m "Apply autoformatting with Black" | |
| git push | |
| # - name: Create Pull Request | |
| # if: steps.black_format.outputs.changes_made == 'true' | |
| # uses: peter-evans/create-pull-request@v4 | |
| # with: | |
| # # token: ${{ secrets.PERSONAL_ACCESS_TOKEN }} | |
| # commit-message: "Apply autoformatting with Black" | |
| # title: "Apply autoformatting with Black" | |
| # body: "Automated changes to apply Black code formatting." | |
| # branch: "autoformat/black-${{ github.run_number }}" | |
| # delete-branch: true | |
| # draft: false |