diff --git a/.github/workflows/format-prettier.yml b/.github/workflows/format-prettier.yml new file mode 100644 index 000000000..5b33ebdf1 --- /dev/null +++ b/.github/workflows/format-prettier.yml @@ -0,0 +1,34 @@ +name: Format with Prettier + +on: + workflow_dispatch: + pull_request: + types: [opened, synchronize] + +jobs: + prettier: + runs-on: ubuntu-latest + steps: + - name: Checkout (full) + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Use Node.js + uses: actions/setup-node@v4 + with: + node-version: '18' + + - name: Install dependencies + run: | + npm ci || npm install + npm install --no-save prettier + + - name: Run Prettier (format) + run: npx prettier --write "**/*.{js,jsx,ts,tsx,json,md}" + + - name: Commit formatted changes + uses: EndBug/add-and-commit@v9 + with: + message: "chore: format code with Prettier" + add: "."