From 7f4922ae61b55b2cce5daf900c6b1a99cce76dff Mon Sep 17 00:00:00 2001 From: Kelly Sovacool Date: Thu, 7 Nov 2024 11:12:14 -0500 Subject: [PATCH] ci: add auto format action --- .github/workflows/auto-format.yml | 35 +++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 .github/workflows/auto-format.yml diff --git a/.github/workflows/auto-format.yml b/.github/workflows/auto-format.yml new file mode 100644 index 0000000..f4ace26 --- /dev/null +++ b/.github/workflows/auto-format.yml @@ -0,0 +1,35 @@ +name: auto-format + +on: + workflow_dispatch: + pull_request: + +env: + GH_TOKEN: ${{ github.token }} + +jobs: + auto-format: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + if: github.event_name == 'pull_request' + with: + fetch-depth: 0 + ref: ${{ github.event.pull_request.head.ref }} + + - uses: actions/checkout@v4 + if: github.event_name == 'push' + with: + fetch-depth: 0 + + - name: format + uses: pre-commit/action@v3.0.1 + continue-on-error: true + + - name: commit & push + run: | + git config --global user.name "github-actions[bot]" + git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" + git add . + git commit -m "ci: 🤖 format everything with pre-commit" && git push || echo "nothing to commit"