chore: add bun formatting workflows

This commit is contained in:
xixu-me committed 2026-03-27 16:49:33 +08:00
1 parent 55eeff23a8
commit fd16a433fb
12 files changed
+208 -40

No files matched your search

+29
View File
@@ -0,0 +1,29 @@
name: Format Check
on:
pull_request:
push:
branches:
- main
permissions:
contents: read
jobs:
prettier:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v6
- name: Set up Bun
uses: oven-sh/setup-bun@v2.2.0
with:
bun-version: 1.3.11
- name: Install dependencies
run: bun install --frozen-lockfile
- name: Verify formatting
run: bun run format:check
+48
View File
@@ -0,0 +1,48 @@
name: Format Fix
on:
workflow_dispatch:
permissions:
contents: write
jobs:
prettier:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v6
- name: Ensure the selected ref is a branch
shell: bash
run: |
if [[ "${GITHUB_REF_TYPE}" != "branch" ]]; then
echo "Format Fix must be run against a branch ref."
exit 1
fi
- name: Set up Bun
uses: oven-sh/setup-bun@v2.2.0
with:
bun-version: 1.3.11
- name: Install dependencies
run: bun install --frozen-lockfile
- name: Apply formatting
run: bun run format
- name: Commit formatting changes
shell: bash
run: |
if git diff --quiet; then
echo "No formatting changes to commit."
exit 0
fi
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add .
git commit -m "chore: apply formatting"
git push