mirror of
https://github.com/DayuanJiang/next-ai-draw-io.git
synced 2026-01-03 06:42:27 +08:00
- Add GitHub Action to auto-format PRs with Biome - Fix formatting in app/manifest.ts and scripts/test-diagram-operations.mjs
48 lines
1.2 KiB
YAML
48 lines
1.2 KiB
YAML
name: Auto Format
|
|
|
|
on:
|
|
pull_request:
|
|
types: [opened, synchronize]
|
|
|
|
permissions:
|
|
contents: write
|
|
|
|
jobs:
|
|
format:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
with:
|
|
ref: ${{ github.head_ref }}
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: '20'
|
|
|
|
- name: Install Biome
|
|
run: npm install --save-dev @biomejs/biome
|
|
|
|
- name: Run Biome format
|
|
run: npx @biomejs/biome check --write --no-errors-on-unmatched .
|
|
|
|
- name: Check for changes
|
|
id: changes
|
|
run: |
|
|
if git diff --quiet; then
|
|
echo "has_changes=false" >> $GITHUB_OUTPUT
|
|
else
|
|
echo "has_changes=true" >> $GITHUB_OUTPUT
|
|
fi
|
|
|
|
- name: Commit changes
|
|
if: steps.changes.outputs.has_changes == 'true'
|
|
run: |
|
|
git config --global user.name "github-actions[bot]"
|
|
git config --global user.email "github-actions[bot]@users.noreply.github.com"
|
|
git add .
|
|
git commit -m "style: auto-format with Biome"
|
|
git push
|