Skip to content

Commit 39af52d

Browse files
committed
feat(CI): add prettier job
1 parent 0d0a307 commit 39af52d

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

.github/workflows/ci.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,32 @@ on:
99
- main
1010

1111
jobs:
12+
prettier:
13+
runs-on: ubuntu-latest
14+
permissions:
15+
contents: write
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v6
19+
- name: Setup bun
20+
uses: oven-sh/setup-bun@v2
21+
with:
22+
bun-version: latest
23+
- name: Run prettier
24+
run: bunx prettier@v3 -w .
25+
- name: Commit if changed
26+
if: github.event_name == 'pull_request'
27+
run: |
28+
if [[ -n "$(git status --porcelain)" ]]; then
29+
git config user.name "github-actions[bot]"
30+
git config user.email "${{ github.actor_id }}+${{ github.actor }}@users.noreply.github.com"
31+
git add .
32+
git commit -m "chore: format code with prettier" -m 'skip ci'
33+
git push origin "$(git branch --show-current)"
34+
else
35+
echo "No changes to commit"
36+
fi
37+
1238
checks:
1339
permissions:
1440
contents: read

0 commit comments

Comments
 (0)