Skip to content

Commit

Permalink
ci: add auto format action
Browse files Browse the repository at this point in the history
  • Loading branch information
kelly-sovacool committed Nov 7, 2024
1 parent 4cbf075 commit 7f4922a
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/auto-format.yml
Original file line number Diff line number Diff line change
@@ -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/[email protected]
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"

0 comments on commit 7f4922a

Please sign in to comment.