-
Notifications
You must be signed in to change notification settings - Fork 2
41 lines (32 loc) · 966 Bytes
/
format.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
name: Format Code
on: [push, pull_request]
jobs:
format:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout repo
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
- name: Install bun
uses: oven-sh/setup-bun@v2
with:
bun-version: 'latest'
- name: Install dependencies
run: bun install
- name: Format code
run: bun format
- name: Check for changes
id: git-check
run: |
git diff --exit-code || echo "changes=true" >> $GITHUB_OUTPUT
- name: Commit changes if any
if: steps.git-check.outputs.changes == 'true'
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email '41898282+github-actions[bot]@users.noreply.github.com'
git add -A
git commit -m "chore: format code"
git push