Skip to content

Commit 870b9c7

Browse files
committed
Add auto commit for code formating.
1 parent 995cf3a commit 870b9c7

File tree

1 file changed

+21
-6
lines changed

1 file changed

+21
-6
lines changed

.github/workflows/formatting.yml

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,46 @@
11
name: Check Formatting
2-
32
on:
43
push:
54
branches:
65
- ep2025
76
pull_request:
8-
97
jobs:
108
format-check:
119
runs-on: ubuntu-latest
1210
steps:
1311
- name: Checkout
1412
uses: actions/checkout@v4
15-
13+
with:
14+
token: ${{ secrets.COMMENT_TOKEN }}
15+
1616
- name: Set up pnpm
1717
uses: pnpm/action-setup@v4
1818
with:
1919
run_install: false
20-
20+
2121
- name: Set up Node.js
2222
uses: actions/setup-node@v4
2323
with:
2424
node-version: 20
2525
cache: "pnpm"
26-
26+
2727
- name: Install dependencies
2828
run: make install
29-
29+
3030
- name: Check Formatting
31+
id: format-check
3132
run: pnpm format --check
33+
continue-on-error: true
34+
35+
- name: Auto Format
36+
if: steps.format-check.outcome == 'failure'
37+
run: pnpm format
38+
39+
- name: Commit changes
40+
if: steps.format-check.outcome == 'failure'
41+
run: |
42+
git config --local user.email "github-actions[bot]@users.noreply.github.com"
43+
git config --local user.name "github-actions[bot]"
44+
git add .
45+
git commit -m "chore: auto-format code" -m "Automated code formatting."
46+
git push

0 commit comments

Comments
 (0)