opencode_offline/script/format.ts

15 lines
453 B
TypeScript
Raw Normal View History

2025-09-10 11:47:47 +08:00
#!/usr/bin/env bun
import { $ } from "bun"
2025-11-07 02:03:02 +08:00
await $`bun run prettier --ignore-unknown --write .`
2025-09-10 11:47:47 +08:00
if (process.env["CI"] && (await $`git status --porcelain`.text())) {
await $`git config --local user.email "action@github.com"`
await $`git config --local user.name "GitHub Action"`
await $`git add -A`
await $`git commit -m "chore: format code"`
2025-12-08 11:48:41 +08:00
const branch = process.env["PUSH_BRANCH"]
await $`git push origin HEAD:${branch} --no-verify`
2025-09-10 11:47:47 +08:00
}