From 92a8eb529b43185515dc2ae55bb3d40da34f68d6 Mon Sep 17 00:00:00 2001 From: Salman Date: Fri, 1 Nov 2024 05:27:46 +0530 Subject: [PATCH] fix: prettier-action init --- .github/workflows/format.yml | 27 ++++++++++++--------------- README.md | 4 ++++ 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml index f359066..06a6be8 100644 --- a/.github/workflows/format.yml +++ b/.github/workflows/format.yml @@ -3,27 +3,24 @@ name: Format on: push: branches: [main] + pull_request: + branches: [main] jobs: format: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - uses: pnpm/action-setup@v2.2.4 - - - name: Setup Node.js environment - uses: actions/setup-node@v3 + - name: Checkout + uses: actions/checkout@v3 with: - node-version: 18 - - - name: Install dependencies - run: pnpm install --ignore-scripts - - - name: Format - run: pnpm run format + # Make sure the actual branch is checked out when running on pull requests + ref: ${{ github.head_ref }} + # This is important to fetch the changes to the previous commit + fetch-depth: 0 - - name: Add, Commit and Push - uses: stefanzweifel/git-auto-commit-action@v4 + - name: Prettier Action + uses: creyD/prettier_action@v4.3 with: - commit_message: 'Format' + prettier_options: '--config ./.prettierrc --ignore-path .gitignore -w "packages/**/*.{js,ts,json,css,tsx,jsx,md}" "playgrounds/**/*.{js,ts,json,css,tsx,jsx,md}"' + commit_message: "style: auto-format with action" diff --git a/README.md b/README.md index db6c7b4..6a08834 100644 --- a/README.md +++ b/README.md @@ -87,6 +87,10 @@ pnpm run dev This will start all the playground in watch mode. + +> [!NOTE] +> Once a pull request is submitted, we run a prettier auto-format action and create a new commit if it's not formatted properly. Be sure to pull the latest changes after submitting a pull request or run `pnpm run format` to format your changes locally before submitting a new pull request. + ### SolidJS The project is built using [SolidJS](https://www.solidjs.com/). If you are new to SolidJS, we recommend checking out their [documentation](https://www.solidjs.com/docs) and [tutorials](https://www.solidjs.com/tutorial).