Add pre-commit configuration to apply Black formatting #16
Workflow file for this run
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: Autoformat | ||
on: [pull_request] | ||
permissions: | ||
contents: write | ||
jobs: | ||
black: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ github.head_ref }} | ||
fetch-depth: 0 | ||
token: ${{ secrets.GRIPTAPE_AUTOFORMATTER_TOKEN }} | ||
- name: Init environment | ||
uses: ./.github/actions/init-environment | ||
- name: Run formatter | ||
run: black . | ||
- name: Commit any changes | ||
with: | ||
token: ${{ secrets.GRIPTAPE_AUTOFORMATTER_TOKEN }} | ||
run: | | ||
Check failure on line 30 in .github/workflows/autoformat.yml GitHub Actions / AutoformatInvalid workflow file
|
||
if [ "$(git diff --ignore-space-at-eol | wc -l)" -gt "0" ]; then | ||
git config user.name griptape-autoformatter | ||
git config user.email "[email protected]" | ||
git remote set-url origin https://x-access-token:${{ secrets.GRIPTAPE_AUTOFORMATTER_TOKEN }}@github.com/${{ github.repository }} | ||
git commit -am "[autoformat]" | ||
git push | ||
exit 1 | ||
fi |