Skip to content

Commit 076c8b2

Browse files
committed
ci: fix fmt
1 parent 9a90939 commit 076c8b2

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

.github/workflows/format.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
with:
2020
token: ${{ secrets.GITHUB_TOKEN }}
2121
repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }}
22-
ref: ${{ github.event.pull_request.head.sha || github.sha }}
22+
ref: ${{ github.event.pull_request.head.ref || github.ref_name }}
2323

2424
- name: Setup Bun
2525
uses: ./.github/actions/setup-bun
@@ -29,3 +29,4 @@ jobs:
2929
./script/format.ts
3030
env:
3131
CI: true
32+
PUSH_BRANCH: ${{ github.event.pull_request.head.ref || github.ref_name }}

script/format.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,6 @@ if (process.env["CI"] && (await $`git status --porcelain`.text())) {
99
await $`git config --local user.name "GitHub Action"`
1010
await $`git add -A`
1111
await $`git commit -m "chore: format code"`
12-
await $`git push --no-verify`
12+
const branch = process.env["PUSH_BRANCH"]
13+
await $`git push origin HEAD:${branch} --no-verify`
1314
}

0 commit comments

Comments
 (0)