Skip to content

Commit dcfd8cf

Browse files
authored
Update GitHub Actions workflow for formatting changes
1 parent 0e2488b commit dcfd8cf

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

.github/workflows/Format.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,31 @@ on:
66
- main
77
- develop
88
types: [opened, edited, reopened, synchronize]
9+
10+
permissions:
11+
contents: write
12+
913
jobs:
1014
format:
1115
runs-on: ubuntu-latest
1216
steps:
1317
- name: Checkout code
1418
uses: actions/checkout@v4
1519
with:
16-
ref: ${{ github.head_ref }}
20+
ref: ${{ github.event_name == 'pull_request' && github.head_ref || github.ref }}
21+
1722
- name: Setup Bun
1823
uses: oven-sh/[email protected]
1924

2025
- name: Install dependencies
2126
run: bun install
2227

28+
- name: Run formatter
2329
- run: bun run format
30+
2431
- name: Commit changes
32+
if: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.ref != 'develop' }}
2533
uses: stefanzweifel/git-auto-commit-action@v4
2634
with:
2735
commit_message: Apply formatting changes
28-
branch: ${{ github.head_ref }}
36+
branch: ${{ github.event.pull_request.head.ref }}

0 commit comments

Comments
 (0)