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