Browse Source

ci: fix fmt

Aiden Cline 4 months ago
parent
commit
076c8b2ca1
2 changed files with 4 additions and 2 deletions
  1. 2 1
      .github/workflows/format.yml
  2. 2 1
      script/format.ts

+ 2 - 1
.github/workflows/format.yml

@@ -19,7 +19,7 @@ jobs:
         with:
           token: ${{ secrets.GITHUB_TOKEN }}
           repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }}
-          ref: ${{ github.event.pull_request.head.sha || github.sha }}
+          ref: ${{ github.event.pull_request.head.ref || github.ref_name }}
 
       - name: Setup Bun
         uses: ./.github/actions/setup-bun
@@ -29,3 +29,4 @@ jobs:
           ./script/format.ts
         env:
           CI: true
+          PUSH_BRANCH: ${{ github.event.pull_request.head.ref || github.ref_name }}

+ 2 - 1
script/format.ts

@@ -9,5 +9,6 @@ if (process.env["CI"] && (await $`git status --porcelain`.text())) {
   await $`git config --local user.name "GitHub Action"`
   await $`git add -A`
   await $`git commit -m "chore: format code"`
-  await $`git push --no-verify`
+  const branch = process.env["PUSH_BRANCH"]
+  await $`git push origin HEAD:${branch} --no-verify`
 }