summaryrefslogtreecommitdiffhomepage
path: root/script/format.ts
blob: 2ae93f169cc32468fa28d74a8d3171dc6330d168 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#!/usr/bin/env bun

import { $ } from "bun"

await $`bun run prettier --ignore-unknown --write .`

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