Skip to content

Commit b1c705d

Browse files
committed
feat(ci): add auto-format workflow
Automatically runs 'make fmt' on push and pull requests, then commits any formatting changes back to the branch.
1 parent 915551e commit b1c705d

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

.github/workflows/auto-format.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Auto Format
2+
3+
on:
4+
push:
5+
pull_request:
6+
7+
jobs:
8+
format:
9+
runs-on: ubuntu-latest
10+
permissions:
11+
contents: write
12+
pull-requests: write
13+
14+
steps:
15+
- name: Checkout code
16+
uses: actions/checkout@v4
17+
with:
18+
ref: ${{ github.head_ref || github.ref }}
19+
token: ${{ secrets.GITHUB_TOKEN }}
20+
21+
- name: Set up Go
22+
uses: actions/setup-go@v5
23+
with:
24+
go-version: 'stable'
25+
26+
- name: Run make fmt
27+
run: make fmt
28+
29+
- name: Commit changes
30+
uses: stefanzweifel/git-auto-commit-action@v5
31+
with:
32+
commit_message: 'chore: apply code formatting changes'
33+
commit_user_name: 'github-actions[bot]'
34+
commit_user_email: 'github-actions[bot]@users.noreply.github.com'
35+
commit_options: '--no-verify --no-gpg-sign'
36+
skip_dirty_check: false
37+

0 commit comments

Comments
 (0)