From e9b6c2495c7cd48de025089d1e4c8dac64f383f9 Mon Sep 17 00:00:00 2001 From: Dan Ditomaso Date: Wed, 19 Feb 2025 11:28:23 -0500 Subject: [PATCH] feat: apply biome formatting as github action --- .github/workflows/format.yml | 46 ++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 .github/workflows/format.yml diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml new file mode 100644 index 00000000..f9201192 --- /dev/null +++ b/.github/workflows/format.yml @@ -0,0 +1,46 @@ +name: Biome Format + +on: + push: + branches: [ main, master ] + pull_request: + branches: [ main, master ] + workflow_dispatch: + +jobs: + format: + runs-on: ubuntu-latest + + permissions: + # We need to give the default GITHUB_TOKEN write permission to commit and push + contents: write + + steps: + - uses: actions/checkout@v4 + with: + ref: ${{ github.head_ref }} + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + + - name: Install Biome + run: npm install --global @biomejs/biome + + - name: Format with Biome + run: biome format --write . + + - name: Check for changes + id: git-check + run: | + git diff --exit-code || echo "changes=true" >> $GITHUB_OUTPUT + + - name: Commit changes + if: steps.git-check.outputs.changes == 'true' + run: | + git config --local user.email "github-actions[bot]@users.noreply.github.com" + git config --local user.name "github-actions[bot]" + git add -A + git commit -m "chore: format code" + git push \ No newline at end of file